iOS8 GKLocalPlayerInternal无法识别的选择器 [英] iOS8 GKLocalPlayerInternal Unrecognized Selector

查看:96
本文介绍了iOS8 GKLocalPlayerInternal无法识别的选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚在我的设备上安装了ios8,现在收到此错误:

Just installed ios8 on my device and am now receiving this error:

-[GKLocalPlayerInternal name]: unrecognized selector sent to instance 0x1b6e3f80

我没有在安装了ios7的其他两台设备上看到此错误。在安装了ios8的设备上,我已经通过设置验证GameCenter Sandbox已启用 - > GameCenter - >检查Sandbox

I do not see this error on two other devices with ios7 installed. On my device with ios8 installed I have already verified that GameCenter Sandbox is enabled by going to settings -> GameCenter -> Check "Sandbox"

我可以通过评论来避免错误输出以下代码:

I can avoid the error by commenting out this code below:

 // after checking that game center is available and authentication handler has not already been set, set the authentication handlers
[localPlayer setAuthenticateHandler:(^(UIViewController* viewController, NSError *error) {

    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

    if (!error && viewController)
    {
        [self showAuthenticationDialogWhenReasonable: viewController fromBaseViewController:baseController];
    }
    else if (localPlayer.isAuthenticated)
    {
        [self authenticatedPlayerandShowPopUpIfUnable:showPopUp];
    }
    else
    {
        [self disableGameCenterandShowPopUpIfUnable:showPopUp];
    }
})];

堆栈跟踪显示:



  • 线程#1:tid = 0x4011c,0x3775ec64 libobjc.A.dylib`objc_exception_throw,queue ='com.apple.main-thread',stop reason = breakpoint 1.1



frame #0: 0x3775ec64 libobjc.A.dylib`objc_exception_throw
frame #1: 0x2a0b6188 CoreFoundation`-[NSObject(NSObject) doesNotRecognizeSelector:] + 188
frame #2: 0x2a0b40a6 CoreFoundation`___forwarding___ + 714
frame #3: 0x29fe6208 CoreFoundation`_CF_forwarding_prep_0 + 24
frame #4: 0x2d3ff688 SpriteKit`-[SKNode isEqual:] + 164
frame #5: 0x2ad039fe Foundation`+[NSObject(NSDelayedPerforming) cancelPreviousPerformRequestsWithTarget:] + 358
frame #6: 0x30d9b872 GameCenterFoundation`-[GKPlayer postChangeNotification] + 38
frame #7: 0x30daed20 GameCenterFoundation`__52-[GKDaemonProxy setLocalPlayer:authenticated:reply:]_block_invoke + 848
frame #8: 0x0062faea libdispatch.dylib`_dispatch_call_block_and_release + 10
frame #9: 0x0062fad6 libdispatch.dylib`_dispatch_client_callout + 22
frame #10: 0x006334f6 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 810
frame #11: 0x2a076be8 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
frame #12: 0x2a0752e8 CoreFoundation`__CFRunLoopRun + 1512
frame #13: 0x29fc3620 CoreFoundation`CFRunLoopRunSpecific + 476
frame #14: 0x29fc3432 CoreFoundation`CFRunLoopRunInMode + 106
frame #15: 0x313710a8 GraphicsServices`GSEventRunModal + 136
frame #16: 0x2d5ad808 UIKit`UIApplicationMain + 1440
frame #17: 0x0019ddd0 ReconInForce`main(argc=1, argv=0x003c4a5c) + 116 at main.m:16

有关此问题的任何想法吗?

Any thoughts on this issue?

提前致谢!

推荐答案

找到一个解决方案:似乎问题与游戏无关中心登录这么多......

Found a solution: doesn't seem like the problem was related to game center login so much...

我有一些代码采用以下形式:

I had a bit of code that took the form of:

-(void) setAnnimationsPlaying:(BOOL)annimationsPlaying{

    ...some other code...

    _annimationsPlaying = annimationsPlaying;

    if (annimationsPlaying)
        [self performSelector:@selector(xyz) withObject:nil afterDelay:0.1];

}

-(void) xyz{

    if (!self.annimationsPlaying)
       return;

    ...some other code...

    [self performSelector:@selector(xyz) withObject:nil afterDelay:6.0];

}

用这种形式替换代码解决了我的问题:

Replacing that code with something of this form solved my problem:

-(void) setAnnimationsPlaying:(BOOL)annimationsPlaying{

    ...some other code...

    _annimationsPlaying = annimationsPlaying;

    if (self.annimationsPlaying) {
        [self xyz];
        self.timer = [NSTimer scheduledTimerWithTimeInterval:6.0f target:self selector:@selector(xyz) userInfo:nil repeats:YES];
    }else{
        [self.timer invalidate];
    }

}

-(void) xyz{

    if (!self.annimationsPlaying)
       return;

    ...some other code...

}

希望有所帮助!!

这篇关于iOS8 GKLocalPlayerInternal无法识别的选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆