GKLocalPlayer在iOS6上使用模态转换错误进行Auth崩溃

GKLocalPlayer在iOS6上使用模态转换错误进行Auth崩溃,第1张

概述我的应用程序记录了它是否已成功通过Game Center进行身份验证.当它开始新游戏或用户查看分数列表时,如果本地播放器未成功通过身份验证,并且该应用程序当时未尝试对用户进行身份验证,则会再次尝试. (为什么?如果您从无网络区域移动到网络区域.) 不幸的是,在iOS6 / XCode 4.5下,它开始崩溃了.或者至少在某些有限的情况下似乎:用户无法使用错误的密码和/或不存在的帐户登录.成功登录后, @H_301_1@我的应用程序记录了它是否已成功通过Game Center进行身份验证.当它开始新游戏或用户查看分数列表时,如果本地播放器未成功通过身份验证,并且该应用程序当时未尝试对用户进行身份验证,则会再次尝试.

(为什么?如果您从无网络区域移动到网络区域.)

不幸的是,在iOS6 / XCode 4.5下,它开始崩溃了.或者至少在某些有限的情况下似乎:用户无法使用错误的密码和/或不存在的帐户登录.成功登录后,一切顺利.

在登录失败之后,当我去做一些导致进行reauth检查的事情时,我得到了这个:

2012-09-25 15:54:47.829 APP name [1493:907] *
Assertion failure in -[UIWindowController
Transition:fromVIEwController:toVIEwController:target:dIDEndSelector:],
/SourceCache/UIKit/UIKit-2372/UIWindowController.m:211

然后这实际上崩溃了:

2012-09-25 15:55:25.569 APP name [1493:907] *
Terminating app due to uncaught exception
‘NSInternalinconsistencyException’,reason: ‘Attempting to begin a
modal Transition from <GKModalRootVIEwController: 0x1cd8b2a0> to
<GKHostedAuthenticateVIEwController: 0x1e31a350> while a Transition is
already in progress. Wait for vIEwDIDAppear/vIEwDIDdisappear to kNow
the current Transition has completed’
* First throw call stack: (0x394932a3 0x31db297f 0x3949315d 0x383fd2af 0x3640377b 0x36402fcf 0x394969c4 0x393edfeb 0x36521733
0x32a83d2d 0x3264b11f 0x3264a4b7 0x3264f1bd 0x39466f3b 0x393d9ebd
0x393d9d49 0x353132eb 0x3636b301 0x7e863 0x7e808) libc++abi.dylib:
terminate called throwing an exception

这是麻烦的代码:

-(voID)authenticateLocalUser {    if (!self.checkingLocalPlayer) {        self.checkingLocalPlayer = YES;        GKLocalPlayer *thisPlayer = [GKLocalPlayer localPlayer];        if (!thisPlayer.authenticated) {            [[GKLocalPlayer localPlayer]             authenticateWithCompletionHandler:^(NSError *error)             {                 [self finishGameCenterauthWithError:error];             }             ];        }    }}

知道我在这里做错了吗?

解决方法 Ggrrrhhh同样的问题,想想我发现它… ios6已弃用authenticateWithCompletionHandler看到链接,建议你使用AuthenticateHandler.

http://developer.apple.com/library/IOS/#documentation/GameKit/Reference/GKLocalPlayer_Ref/Reference/Reference.html#//apple_ref/occ/instp/GKLocalPlayer/authenticateHandler

这似乎有效……

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];[localPlayer setAuthenticateHandler:(^(UIVIEwController* vIEwcontroller,NSError *error) {//[localPlayer authenticateWithCompletionHandler:^(NSError *error) { olD CODE!    if (localPlayer.isAuthenticated)    {        //do some stuff    }    else {        UIAlertVIEw *alertVIEw = [[UIAlertVIEw alloc]                                  initWithTitle:@"NOT AUTHORISED"                                  message:@"YOUR'RE NOT LOGGED INTO GC."                                  delegate:self                                  cancelbuttonTitle:@"OK"                                  otherbuttonTitles:nil];        [alertVIEw show];    }})];
总结

以上是内存溢出为你收集整理的GKLocalPlayer在iOS6上使用模态转换错误进行Auth崩溃全部内容,希望文章能够帮你解决GKLocalPlayer在iOS6上使用模态转换错误进行Auth崩溃所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1094966.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存