我使用this tutorial創建了一款遊戲。當我打電話authenticateLocalPlayer
像這樣:Objective C GameCenter authenticateHandler錯誤
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler =
^(UIViewController *viewController, NSError *error) {
[self setLastError:error];
if(viewController != nil) {
[self setAuthenticationViewController:viewController];
} else if([GKLocalPlayer localPlayer].isAuthenticated) {
_enableGameCenter = YES;
} else {
_enableGameCenter = NO;
}
};
我得到一個錯誤:
-[GKUnauthenticatedPlayerInternal name]: unrecognized selector sent to instance 0x14517e00
,但是當我添加這樣的:
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[NSThread sleepForTimeInterval:1];
localPlayer.authenticateHandler =
^(UIViewController *viewController, NSError *error) {
[self setLastError:error];
if(viewController != nil) {
[self setAuthenticationViewController:viewController];
} else if([GKLocalPlayer localPlayer].isAuthenticated) {
_enableGameCenter = YES;
} else {
_enableGameCenter = NO;
}
};
它開始工作的罰款。這是解決錯誤的正確方法嗎?
NSThread黑客不適合我。你有沒有找到關於這個的更多信息,或者可能是更好的黑客? – erdekhayser 2014-11-15 03:34:23