저는 iOS를 처음 사용하고 재미있게 차례 기반 iOS 게임을 작성하려고합니다. 지금 로컬 사용자를 인증하려고하는데이 코드는 (주기 유지 경고 임에도 불구하고) 빌드되지만 GameCenter에서 항상 인증에 실패합니다.setAuthenticateHandler가 Game Center에서 인증하지 못했습니다.
// Authenticate the local user.
- (void)authenticateLocalUser
{
if (!gameCenterAvailable) return;
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];
}
}
)];
}
내 예전의 코드는 여전히 작동하지만 iOS6의 감가 상각되었다
NSLog(@"Authenticating local user...");
if ([GKLocalPlayer localPlayer].authenticated == NO)
{
[[GKLocalPlayer localPlayer]
authenticateWithCompletionHandler:nil];
}
else
{
NSLog(@"Already authenticated!");
}
어떤 제안이?
가능한 복제 http://stackoverflow.com/questions/13511030/login-in-iphone-app-via-gamekit – lostInTransit
슬프게도 같은 문제는 아닙니다. –