ios - Game Center authentication always results in sigabrt -
this driving me crazy. every time try authenticate local player game center thread-1 sigkill. happens asynchronously after set localplayer
's authenticatehandler
so:
- (void)authenticatelocalplayer { if([[[uidevice currentdevice] systemversion] floatvalue] >= 6.0) { gklocalplayer __weak *localplayer = [gklocalplayer localplayer]; localplayer.authenticatehandler = ^(uiviewcontroller *viewcontroller, nserror *error) { if (viewcontroller != nil) { [[[[[uiapplication sharedapplication] delegate] window] rootviewcontroller] presentviewcontroller:viewcontroller animated:yes completion:nil]; } else if (localplayer.isauthenticated) { nslog(@"player authenticated"); } else { nslog(@"player authentication failed"); } }; } }
any ideas?
i've seen systemversion tested string comparison instead of number comparison. try printing value of
[[[uidevice currentdevice] systemversion] floatvalue] >= 6.0
to verify there's nothing wrong expression. know following method works:
-(bool) os6 { nsstring *targetsystemversion = @"6.0"; nsstring *currentsystemversion = [[uidevice currentdevice] systemversion]; if ([currentsystemversion compare:targetsystemversion options:nsnumericsearch] == nsorderedascending) { return no; //current system version less 6.0 } else { return yes; } }
Comments
Post a Comment