Update to XCode 9.3 recommended settings and fix "implict retain self" warnings

This commit is contained in:
Cameron Gutman
2018-04-21 22:20:27 -07:00
parent f759f719e6
commit 41eb933e11
5 changed files with 51 additions and 43 deletions

View File

@@ -46,15 +46,15 @@ static NSMutableSet* hostList;
- (void)showPIN:(NSString *)PIN {
dispatch_async(dispatch_get_main_queue(), ^{
_pairAlert = [UIAlertController alertControllerWithTitle:@"Pairing"
self->_pairAlert = [UIAlertController alertControllerWithTitle:@"Pairing"
message:[NSString stringWithFormat:@"Enter the following PIN on the host machine: %@", PIN]
preferredStyle:UIAlertControllerStyleAlert];
[_pairAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
_pairAlert = nil;
[_discMan startDiscovery];
[self->_pairAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
self->_pairAlert = nil;
[self->_discMan startDiscovery];
[self hideLoadingFrame];
}]];
[self presentViewController:_pairAlert animated:YES completion:nil];
[self presentViewController:self->_pairAlert animated:YES completion:nil];
});
}
@@ -71,11 +71,11 @@ static NSMutableSet* hostList;
- (void)pairFailed:(NSString *)message {
dispatch_async(dispatch_get_main_queue(), ^{
if (_pairAlert != nil) {
[_pairAlert dismissViewControllerAnimated:YES completion:^{
if (self->_pairAlert != nil) {
[self->_pairAlert dismissViewControllerAnimated:YES completion:^{
[self displayFailureDialog:message];
}];
_pairAlert = nil;
self->_pairAlert = nil;
}
else {
[self displayFailureDialog:message];
@@ -85,10 +85,10 @@ static NSMutableSet* hostList;
- (void)pairSuccessful {
dispatch_async(dispatch_get_main_queue(), ^{
[_pairAlert dismissViewControllerAnimated:YES completion:nil];
_pairAlert = nil;
[self->_pairAlert dismissViewControllerAnimated:YES completion:nil];
self->_pairAlert = nil;
[_discMan startDiscovery];
[self->_discMan startDiscovery];
[self alreadyPaired];
});
}
@@ -103,11 +103,11 @@ static NSMutableSet* hostList;
if ([host.appList count] > 0) {
usingCachedAppList = true;
dispatch_async(dispatch_get_main_queue(), ^{
if (host != _selectedHost) {
if (host != self->_selectedHost) {
return;
}
_computerNameButton.title = host.name;
self->_computerNameButton.title = host.name;
[self.navigationController.navigationBar setNeedsLayout];
[self updateAppsForHost:host];
@@ -117,18 +117,18 @@ static NSMutableSet* hostList;
Log(LOG_I, @"Using cached app list: %d", usingCachedAppList);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Exempt this host from discovery while handling the applist query
[_discMan removeHostFromDiscovery:host];
[self->_discMan removeHostFromDiscovery:host];
AppListResponse* appListResp = [ConnectionHelper getAppListForHostWithHostIP:host.activeAddress deviceName:deviceName cert:_cert uniqueID:_uniqueId];
AppListResponse* appListResp = [ConnectionHelper getAppListForHostWithHostIP:host.activeAddress deviceName:deviceName cert:self->_cert uniqueID:self->_uniqueId];
[_discMan addHostToDiscovery:host];
[self->_discMan addHostToDiscovery:host];
if (appListResp == nil || ![appListResp isStatusOk] || [appListResp getAppList] == nil) {
Log(LOG_W, @"Failed to get applist: %@", appListResp.statusMessage);
dispatch_async(dispatch_get_main_queue(), ^{
[self hideLoadingFrame];
if (host != _selectedHost) {
if (host != self->_selectedHost) {
return;
}
@@ -144,16 +144,16 @@ static NSMutableSet* hostList;
dispatch_async(dispatch_get_main_queue(), ^{
[self updateApplist:[appListResp getAppList] forHost:host];
if (host != _selectedHost) {
if (host != self->_selectedHost) {
return;
}
_computerNameButton.title = host.name;
self->_computerNameButton.title = host.name;
[self.navigationController.navigationBar setNeedsLayout];
[self updateAppsForHost:host];
[_appManager stopRetrieving];
[_appManager retrieveAssetsFromHost:host];
[self->_appManager stopRetrieving];
[self->_appManager retrieveAssetsFromHost:host];
[self hideLoadingFrame];
});
}
@@ -266,21 +266,21 @@ static NSMutableSet* hostList;
[self showLoadingFrame];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
HttpManager* hMan = [[HttpManager alloc] initWithHost:host.activeAddress uniqueId:_uniqueId deviceName:deviceName cert:_cert];
HttpManager* hMan = [[HttpManager alloc] initWithHost:host.activeAddress uniqueId:self->_uniqueId deviceName:deviceName cert:self->_cert];
ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init];
// Exempt this host from discovery while handling the serverinfo request
[_discMan removeHostFromDiscovery:host];
[self->_discMan removeHostFromDiscovery:host];
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:serverInfoResp withUrlRequest:[hMan newServerInfoRequest]
fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]];
[_discMan addHostToDiscovery:host];
[self->_discMan addHostToDiscovery:host];
if (serverInfoResp == nil || ![serverInfoResp isStatusOk]) {
Log(LOG_W, @"Failed to get server info: %@", serverInfoResp.statusMessage);
dispatch_async(dispatch_get_main_queue(), ^{
[self hideLoadingFrame];
if (host != _selectedHost) {
if (host != self->_selectedHost) {
return;
}
@@ -300,9 +300,9 @@ static NSMutableSet* hostList;
} else {
Log(LOG_I, @"Trying to pair");
// Polling the server while pairing causes the server to screw up
[_discMan stopDiscoveryBlocking];
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:_cert callback:self];
[_opQueue addOperation:pMan];
[self->_discMan stopDiscoveryBlocking];
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:self->_cert callback:self];
[self->_opQueue addOperation:pMan];
}
}
});
@@ -329,7 +329,7 @@ static NSMutableSet* hostList;
}]];
}
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Remove Host" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
[_discMan removeHostFromDiscovery:host];
[self->_discMan removeHostFromDiscovery:host];
DataManager* dataMan = [[DataManager alloc] init];
[dataMan removeHost:host];
@synchronized(hostList) {
@@ -357,7 +357,7 @@ static NSMutableSet* hostList;
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
NSString* hostAddress = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){
[self->_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){
if (host != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
@synchronized(hostList) {
@@ -415,12 +415,12 @@ static NSMutableSet* hostList;
[app.id isEqualToString:currentApp.id] ? @"Quit App" : @"Quit Running App and Start" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action){
Log(LOG_I, @"Quitting application: %@", currentApp.name);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
HttpManager* hMan = [[HttpManager alloc] initWithHost:app.host.activeAddress uniqueId:_uniqueId deviceName:deviceName cert:_cert];
HttpManager* hMan = [[HttpManager alloc] initWithHost:app.host.activeAddress uniqueId:self->_uniqueId deviceName:deviceName cert:self->_cert];
HttpResponse* quitResponse = [[HttpResponse alloc] init];
HttpRequest* quitRequest = [HttpRequest requestForResponse: quitResponse withUrlRequest:[hMan newQuitAppRequest]];
// Exempt this host from discovery while handling the quit operation
[_discMan removeHostFromDiscovery:app.host];
[self->_discMan removeHostFromDiscovery:app.host];
[hMan executeRequestSynchronously:quitRequest];
if (quitResponse.statusCode == 200) {
ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init];
@@ -433,7 +433,7 @@ static NSMutableSet* hostList;
quitResponse.statusCode = 599;
}
}
[_discMan addHostToDiscovery:app.host];
[self->_discMan addHostToDiscovery:app.host];
UIAlertController* alert;

View File

@@ -1425,10 +1425,10 @@ const int FrontViewPositionNone = 0xff;
// We call the layoutSubviews method on the contentView view and send a delegate, which will
// occur inside of an animation block if any animated transition is being performed
[_contentView layoutSubviews];
[self->_contentView layoutSubviews];
if ([_delegate respondsToSelector:@selector(revealController:animateToPosition:)])
[_delegate revealController:self animateToPosition:_frontViewPosition];
if ([self->_delegate respondsToSelector:@selector(revealController:animateToPosition:)])
[self->_delegate revealController:self animateToPosition:self->_frontViewPosition];
};
void (^completion)(BOOL) = ^(BOOL finished)
@@ -1494,8 +1494,8 @@ const int FrontViewPositionNone = 0xff;
void (^animationCompletion)(void) = ^
{
completion();
if ( [_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] )
[_delegate revealController:self didAddViewController:new forOperation:operation animated:animated];
if ( [self->_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] )
[self->_delegate revealController:self didAddViewController:new forOperation:operation animated:animated];
[self _dequeue];
};
@@ -1561,8 +1561,8 @@ const int FrontViewPositionNone = 0xff;
deploymentCompletion();
if ( positionIsChanging )
{
if ( [_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] )
[_delegate revealController:self didMoveToPosition:newPosition];
if ( [self->_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] )
[self->_delegate revealController:self didMoveToPosition:newPosition];
}
};

View File

@@ -76,7 +76,7 @@
[self.spinner stopAnimating];
[self.stageLabel setText:@"Waiting for first frame..."];
[self.stageLabel sizeToFit];
[(StreamView*)self.view setupOnScreenControls: _controllerSupport swipeDelegate:self];
[(StreamView*)self.view setupOnScreenControls: self->_controllerSupport swipeDelegate:self];
});
}

View File

@@ -816,7 +816,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Moonlight Game Streaming Project";
TargetAttributes = {
D46A739F1CBC7CB60039F1EE = {
@@ -1044,12 +1044,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -1096,12 +1098,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;

View File

@@ -285,7 +285,7 @@
FB290E2619B37A4E004C83CF /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Moonlight Stream";
};
buildConfigurationList = FB290E2919B37A4E004C83CF /* Build configuration list for PBXProject "moonlight-common" */;
@@ -355,12 +355,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -409,12 +411,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;