
此外,为presentVIEwController提供完成处理程序:animated:completion:完全不需要,因为完成处理程序是在游戏中心视图显示之后调用的,而不是在完成后才调用.
这是我的解决方案:
注意 – 仅在iOS 4.3,iOS 5.1,iOS 6.0模拟器上测试 – 不在实际设备上.
注意 – 这假定您检查了GameCenter API是否可用.
- (voID)checkLocalPlayer{ GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; if (localPlayer.isAuthenticated) { /* Perform additional tasks for the authenticated player here */ } else { /* Perform additional tasks for the non-authenticated player here */ }}#define SYstem_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] \compare:v options:NSNumericSearch] == NSOrderedAscending)- (voID)authenticateLocalPlayer{ GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; if (SYstem_VERSION_LESS_THAN(@"6.0")) { // ios 5.x and below [localPlayer authenticateWithCompletionHandler:^(NSError *error) { [self checkLocalPlayer]; }]; } else { // ios 6.0 and above [localPlayer setAuthenticateHandler:(^(UIVIEwController* vIEwcontroller,NSError *error) { if (!error && vIEwcontroller) { [[AppDelegate sharedDelegate].vIEwController presentVIEwController:vIEwcontroller animated:YES completion:nil]; } else { [self checkLocalPlayer]; } })]; } }} 总结 以上是内存溢出为你收集整理的ios – authPlayerWithCompletionHandler不推荐使用,所以如何使用authenticateHandler全部内容,希望文章能够帮你解决ios – authPlayerWithCompletionHandler不推荐使用,所以如何使用authenticateHandler所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)