로컬 플레이어 인증이 작동하는지 여부를 감지하려고하고 있으며 항상 긍정적 인 결과를 얻은 것으로 보입니다. 추적 출력게임 센터 localPlayer가 항상 인증 됨
//--------------------------------------------------------------
- (void)authenticateLocalPlayer
{
NSLog(@"Authenticating local player %@ (%d)", ([GKLocalPlayer localPlayer].authenticated? @"YES":@"NO"), [GKLocalPlayer localPlayer].authenticated);
if ([GKLocalPlayer localPlayer].authenticated == NO) {
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
[self callDelegateOnMainThread:@selector(authenticationChanged:)
withArg:nil
error:error];
}];
}
}
//--------------------------------------------------------------
- (void)authenticationChanged:(NSError *)error {
if (error != nil) {
NSLog(@"Error authenticating local player: %@", [error localizedDescription]);
}
NSLog(@"Authentication changed %@ (%d)", ([GKLocalPlayer localPlayer].authenticated? @"YES":@"NO"), [GKLocalPlayer localPlayer].authenticated);
}
내가 여기있는 동안 네트워크에 연결하고이 코드를 테스트 :
2010-12-13 13:20:59.799 LittleScreams[954:307] Authenticating local player NO (0)
2010-12-13 13:21:01.616 LittleScreams[954:307] Error authenticating local player: The Internet connection appears to be offline.
2010-12-13 13:21:01.621 LittleScreams[954:307] Authentication changed YES (1)
그것은 명확하게 연결이 오프라인 상태임을보고 여기
내가 사용하고있는 코드입니다 아직 플레이어를 인증하고 있습니다! 무슨 일이야? 나는 장치와 시뮬레이터에서 같은 결과를 얻고있다.TIA는
나는 비슷한 문제가 있습니다. Game Center 기능을 테스트하고 비행 모드에서 어떤 일이 일어나는지보고 싶었습니다. 비행 모드로 들어가기 전에 Game Center에 로그인 한 경우 앱에서 플레이어를 승인하지 않지만 [localPlayer isAuthenticated]를 수행 할 때 Game Center에 로그인 한 플레이어 ID로 YES가 표시됩니다. 문제에 대한 해결책을 찾았습니까? – Structurer