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
@@ -46,15 +46,15 @@ static NSMutableSet* hostList;
- (void)showPIN:(NSString *)PIN { - (void)showPIN:(NSString *)PIN {
dispatch_async(dispatch_get_main_queue(), ^{ 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] message:[NSString stringWithFormat:@"Enter the following PIN on the host machine: %@", PIN]
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[_pairAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { [self->_pairAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
_pairAlert = nil; self->_pairAlert = nil;
[_discMan startDiscovery]; [self->_discMan startDiscovery];
[self hideLoadingFrame]; [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 { - (void)pairFailed:(NSString *)message {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (_pairAlert != nil) { if (self->_pairAlert != nil) {
[_pairAlert dismissViewControllerAnimated:YES completion:^{ [self->_pairAlert dismissViewControllerAnimated:YES completion:^{
[self displayFailureDialog:message]; [self displayFailureDialog:message];
}]; }];
_pairAlert = nil; self->_pairAlert = nil;
} }
else { else {
[self displayFailureDialog:message]; [self displayFailureDialog:message];
@@ -85,10 +85,10 @@ static NSMutableSet* hostList;
- (void)pairSuccessful { - (void)pairSuccessful {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[_pairAlert dismissViewControllerAnimated:YES completion:nil]; [self->_pairAlert dismissViewControllerAnimated:YES completion:nil];
_pairAlert = nil; self->_pairAlert = nil;
[_discMan startDiscovery]; [self->_discMan startDiscovery];
[self alreadyPaired]; [self alreadyPaired];
}); });
} }
@@ -103,11 +103,11 @@ static NSMutableSet* hostList;
if ([host.appList count] > 0) { if ([host.appList count] > 0) {
usingCachedAppList = true; usingCachedAppList = true;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (host != _selectedHost) { if (host != self->_selectedHost) {
return; return;
} }
_computerNameButton.title = host.name; self->_computerNameButton.title = host.name;
[self.navigationController.navigationBar setNeedsLayout]; [self.navigationController.navigationBar setNeedsLayout];
[self updateAppsForHost:host]; [self updateAppsForHost:host];
@@ -117,18 +117,18 @@ static NSMutableSet* hostList;
Log(LOG_I, @"Using cached app list: %d", usingCachedAppList); Log(LOG_I, @"Using cached app list: %d", usingCachedAppList);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Exempt this host from discovery while handling the applist query // 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) { if (appListResp == nil || ![appListResp isStatusOk] || [appListResp getAppList] == nil) {
Log(LOG_W, @"Failed to get applist: %@", appListResp.statusMessage); Log(LOG_W, @"Failed to get applist: %@", appListResp.statusMessage);
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self hideLoadingFrame]; [self hideLoadingFrame];
if (host != _selectedHost) { if (host != self->_selectedHost) {
return; return;
} }
@@ -144,16 +144,16 @@ static NSMutableSet* hostList;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self updateApplist:[appListResp getAppList] forHost:host]; [self updateApplist:[appListResp getAppList] forHost:host];
if (host != _selectedHost) { if (host != self->_selectedHost) {
return; return;
} }
_computerNameButton.title = host.name; self->_computerNameButton.title = host.name;
[self.navigationController.navigationBar setNeedsLayout]; [self.navigationController.navigationBar setNeedsLayout];
[self updateAppsForHost:host]; [self updateAppsForHost:host];
[_appManager stopRetrieving]; [self->_appManager stopRetrieving];
[_appManager retrieveAssetsFromHost:host]; [self->_appManager retrieveAssetsFromHost:host];
[self hideLoadingFrame]; [self hideLoadingFrame];
}); });
} }
@@ -266,21 +266,21 @@ static NSMutableSet* hostList;
[self showLoadingFrame]; [self showLoadingFrame];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 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]; ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init];
// Exempt this host from discovery while handling the serverinfo request // 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] [hMan executeRequestSynchronously:[HttpRequest requestForResponse:serverInfoResp withUrlRequest:[hMan newServerInfoRequest]
fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]]; fallbackError:401 fallbackRequest:[hMan newHttpServerInfoRequest]]];
[_discMan addHostToDiscovery:host]; [self->_discMan addHostToDiscovery:host];
if (serverInfoResp == nil || ![serverInfoResp isStatusOk]) { if (serverInfoResp == nil || ![serverInfoResp isStatusOk]) {
Log(LOG_W, @"Failed to get server info: %@", serverInfoResp.statusMessage); Log(LOG_W, @"Failed to get server info: %@", serverInfoResp.statusMessage);
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self hideLoadingFrame]; [self hideLoadingFrame];
if (host != _selectedHost) { if (host != self->_selectedHost) {
return; return;
} }
@@ -300,9 +300,9 @@ static NSMutableSet* hostList;
} else { } else {
Log(LOG_I, @"Trying to pair"); Log(LOG_I, @"Trying to pair");
// Polling the server while pairing causes the server to screw up // Polling the server while pairing causes the server to screw up
[_discMan stopDiscoveryBlocking]; [self->_discMan stopDiscoveryBlocking];
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:_cert callback:self]; PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:self->_cert callback:self];
[_opQueue addOperation:pMan]; [self->_opQueue addOperation:pMan];
} }
} }
}); });
@@ -329,7 +329,7 @@ static NSMutableSet* hostList;
}]]; }]];
} }
[longClickAlert addAction:[UIAlertAction actionWithTitle:@"Remove Host" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { [longClickAlert addAction:[UIAlertAction actionWithTitle:@"Remove Host" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
[_discMan removeHostFromDiscovery:host]; [self->_discMan removeHostFromDiscovery:host];
DataManager* dataMan = [[DataManager alloc] init]; DataManager* dataMan = [[DataManager alloc] init];
[dataMan removeHost:host]; [dataMan removeHost:host];
@synchronized(hostList) { @synchronized(hostList) {
@@ -357,7 +357,7 @@ static NSMutableSet* hostList;
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
NSString* hostAddress = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text; NSString* hostAddress = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ 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) { if (host != nil) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
@synchronized(hostList) { @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){ [app.id isEqualToString:currentApp.id] ? @"Quit App" : @"Quit Running App and Start" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action){
Log(LOG_I, @"Quitting application: %@", currentApp.name); Log(LOG_I, @"Quitting application: %@", currentApp.name);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 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]; HttpResponse* quitResponse = [[HttpResponse alloc] init];
HttpRequest* quitRequest = [HttpRequest requestForResponse: quitResponse withUrlRequest:[hMan newQuitAppRequest]]; HttpRequest* quitRequest = [HttpRequest requestForResponse: quitResponse withUrlRequest:[hMan newQuitAppRequest]];
// Exempt this host from discovery while handling the quit operation // Exempt this host from discovery while handling the quit operation
[_discMan removeHostFromDiscovery:app.host]; [self->_discMan removeHostFromDiscovery:app.host];
[hMan executeRequestSynchronously:quitRequest]; [hMan executeRequestSynchronously:quitRequest];
if (quitResponse.statusCode == 200) { if (quitResponse.statusCode == 200) {
ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init]; ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init];
@@ -433,7 +433,7 @@ static NSMutableSet* hostList;
quitResponse.statusCode = 599; quitResponse.statusCode = 599;
} }
} }
[_discMan addHostToDiscovery:app.host]; [self->_discMan addHostToDiscovery:app.host];
UIAlertController* alert; UIAlertController* alert;
@@ -1425,10 +1425,10 @@ const int FrontViewPositionNone = 0xff;
// We call the layoutSubviews method on the contentView view and send a delegate, which will // 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 // occur inside of an animation block if any animated transition is being performed
[_contentView layoutSubviews]; [self->_contentView layoutSubviews];
if ([_delegate respondsToSelector:@selector(revealController:animateToPosition:)]) if ([self->_delegate respondsToSelector:@selector(revealController:animateToPosition:)])
[_delegate revealController:self animateToPosition:_frontViewPosition]; [self->_delegate revealController:self animateToPosition:self->_frontViewPosition];
}; };
void (^completion)(BOOL) = ^(BOOL finished) void (^completion)(BOOL) = ^(BOOL finished)
@@ -1494,8 +1494,8 @@ const int FrontViewPositionNone = 0xff;
void (^animationCompletion)(void) = ^ void (^animationCompletion)(void) = ^
{ {
completion(); completion();
if ( [_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] ) if ( [self->_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] )
[_delegate revealController:self didAddViewController:new forOperation:operation animated:animated]; [self->_delegate revealController:self didAddViewController:new forOperation:operation animated:animated];
[self _dequeue]; [self _dequeue];
}; };
@@ -1561,8 +1561,8 @@ const int FrontViewPositionNone = 0xff;
deploymentCompletion(); deploymentCompletion();
if ( positionIsChanging ) if ( positionIsChanging )
{ {
if ( [_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] ) if ( [self->_delegate respondsToSelector:@selector(revealController:didMoveToPosition:)] )
[_delegate revealController:self didMoveToPosition:newPosition]; [self->_delegate revealController:self didMoveToPosition:newPosition];
} }
}; };
@@ -76,7 +76,7 @@
[self.spinner stopAnimating]; [self.spinner stopAnimating];
[self.stageLabel setText:@"Waiting for first frame..."]; [self.stageLabel setText:@"Waiting for first frame..."];
[self.stageLabel sizeToFit]; [self.stageLabel sizeToFit];
[(StreamView*)self.view setupOnScreenControls: _controllerSupport swipeDelegate:self]; [(StreamView*)self.view setupOnScreenControls: self->_controllerSupport swipeDelegate:self];
}); });
} }
+5 -1
View File
@@ -816,7 +816,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 0730; LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0920; LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Moonlight Game Streaming Project"; ORGANIZATIONNAME = "Moonlight Game Streaming Project";
TargetAttributes = { TargetAttributes = {
D46A739F1CBC7CB60039F1EE = { D46A739F1CBC7CB60039F1EE = {
@@ -1044,12 +1044,14 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -1096,12 +1098,14 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -285,7 +285,7 @@
FB290E2619B37A4E004C83CF /* Project object */ = { FB290E2619B37A4E004C83CF /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0920; LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Moonlight Stream"; ORGANIZATIONNAME = "Moonlight Stream";
}; };
buildConfigurationList = FB290E2919B37A4E004C83CF /* Build configuration list for PBXProject "moonlight-common" */; buildConfigurationList = FB290E2919B37A4E004C83CF /* Build configuration list for PBXProject "moonlight-common" */;
@@ -355,12 +355,14 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -409,12 +411,14 @@
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_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_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;