Created
October 1, 2012 04:07
-
-
Save jerryhjones/3809413 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)authenticateLocalPlayer | |
{ | |
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { | |
[self callSelfOnMainThread:@selector(didAuthenticateLocalPlayer:) withArg:error error:nil]; | |
}]; | |
} | |
- (void)callSelf:(SEL)selector withArg:(id)arg error:(NSError*)err | |
{ | |
assert([NSThread isMainThread]); | |
if([self respondsToSelector: selector]) | |
{ | |
if(arg != NULL) | |
{ | |
[self performSelector: selector withObject: arg withObject: err]; | |
} | |
else | |
{ | |
[self performSelector: selector withObject: err]; | |
} | |
} | |
else | |
{ | |
NSLog(@"Missed Method"); | |
} | |
} | |
- (void)callSelfOnMainThread:(SEL)selector withArg:(id)arg error:(NSError*)err | |
{ | |
dispatch_async(dispatch_get_main_queue(), ^(void) { | |
[self callSelf:selector withArg:arg error:err]; | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment