簡體   English   中英

Gamecenter身份驗證問題

[英]Gamecenter authentication issue

所以我更新了我為游戲中心驗證玩家的方式,我在啟動時仍然遇到了崩潰。

這是我認證的新方式:

- (void) authenticateLocalPlayer
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
    if (viewController != nil)
    {
        NSLog (@"user not logged in to GC");
    }
    else if ([GKLocalPlayer localPlayer].isAuthenticated)
    {
        NSLog(@"gamecenter authentication process succeeded");
    }
    else
    {
        NSLog(@"user not authenicated");
    }
};
}

這是崩潰時顯示的內容:

2014-11-12 16:20:43.295 ZombieConga[7492:881764] -[GKLocalPlayerInternal name]: unrecognized       selector sent to instance 0x7974b8c0
2014-11-12 16:20:43.298 ZombieConga[7492:881764] *** Terminating app due to uncaught     exception 'NSInvalidArgumentException', reason: '-[GKLocalPlayerInternal name]: unrecognized   selector sent to instance 0x7974b8c0'
*** First throw call stack:
(
0   CoreFoundation                      0x01ef6946 __exceptionPreprocess + 182
1   libobjc.A.dylib                     0x01b8ea97 objc_exception_throw + 44
2   CoreFoundation                      0x01efe5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3   CoreFoundation                      0x01e473e7 ___forwarding___ + 1047
4   CoreFoundation                      0x01e46fae _CF_forwarding_prep_0 + 14
5   SpriteKit                           0x01a20f82 -[SKNode isEqual:] + 124
6   Foundation                          0x015f5612 +[NSObject(NSDelayedPerforming) cancelPreviousPerformRequestsWithTarget:] + 345
7   GameCenterFoundation                0x0b1ef11e -[GKPlayer postChangeNotification] + 45
8   GameCenterFoundation                0x0b209aa8 __52-[GKDaemonProxy setLocalPlayer:authenticated:reply:]_block_invoke + 922
9   libdispatch.dylib                   0x0237a30a _dispatch_call_block_and_release + 15
10  libdispatch.dylib                   0x0239ae2f _dispatch_client_callout + 14
11  libdispatch.dylib                   0x0238190e _dispatch_main_queue_callback_4CF + 606
12  CoreFoundation                      0x01e5095e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
13  CoreFoundation                      0x01e0f760 __CFRunLoopRun + 2256
14  CoreFoundation                      0x01e0ebcb CFRunLoopRunSpecific + 443
15  CoreFoundation                      0x01e0e9fb CFRunLoopRunInMode + 123
16  GraphicsServices                    0x036dc24f GSEventRunModal + 192
17  GraphicsServices                    0x036dc08c GSEventRun + 104
18  UIKit                               0x0019f8b6 UIApplicationMain + 1526
19  ZombieConga                         0x000f898d main + 141
20  libdyld.dylib                       0x023c6ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

為什么會崩潰?

我的游戲解決方案很奇怪(我完全不了解它)。 通過將調用移動到[self authorizeLocalPlayer]直到生命周期的后期,例如當我第一次初始化SKScene時,而不是早期-(void)viewDidLoad ,它會阻止此崩潰。

我認為這與線程問題有關,但我不能確定。 我對代碼所做的一些更改,似乎無關,與多線程有關,導致它再次中斷(我不得不改變對performSelector:withObject:afterDelay:的調用performSelector:withObject:afterDelay: to [NSTimer scheduledTimerWith...]

基本上,這是一個非常難以追查的問題,需要一些麻煩。 對不起,我不能更具體:(

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM