iOS 게임에서 우리는 Game Center를 사용하여 플레이어를 식별하고 자체 서버를 사용하여 장치간에 데이터를 동기화합니다. Game Center는 플레이어를 식별하기 때문에 인증되었는지 또는 인증 변경 여부 등을 알아야합니다. 인증 호출이 반환 될 때까지 "게임 센터 초기화 중 ..."이라는 제목의 스크린이 있습니다. 우리는 누구에게 인증을 받았는지 알고 있습니다.간혹 Game Center 인증 처리기가 호출되지 않습니다
그러나 시간의 양이 매우 짧습니다. 사실, 인증 처리기는 절대로 호출되지 않습니다. 기다리지도 못했습니다. Game Center 환영 배너는 결코 표시되지 않으므로 우리의 처리기가 호출되지 않는다는 것이 아니라 실제로 인증 상태가없는 것으로 보입니다.
지금까지 Game Center에서 아무 것도 듣지 못하면 인증 상태가 변경되지 않았다고 가정하고 저장된 데이터를 사용합니다. 30 초 제한 시간은 이상적이지 않으므로 GC가 응답하지 않을 때 운율이나 이유가 있는지 궁금합니다. 여기
우리의 앱 위임의application: didFinishLaunchingWithOptions:
방법에서 호출되는 코드입니다 :
PlayerModel *playerModel = [PlayerModel sharedPlayerModel];
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
if ([localPlayer respondsToSelector:@selector(setAuthenticateHandler:)])
{
localPlayer.authenticateHandler = ^(UIViewController *gkViewController, NSError *error)
{
if (localPlayer.authenticated)
{
[playerModel loadFromGameCenter];
playerModel.hasGCStatus = TRUE;
[playerModel sync];
}
else if (gkViewController)
{
[viewController presentViewController:gkViewController animated:TRUE completion:nil];
}
else
{
NSLog(@"Could not authenticate with Game Center");
[playerModel unloadFromGameCenter];
playerModel.hasGCStatus = TRUE;
[playerModel sync];
}
};
}
else
{
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.authenticated)
{
[playerModel loadFromGameCenter];
playerModel.hasGCStatus = TRUE;
[playerModel sync];
}
else
{
NSLog(@"Could not authenticate with Game Center");
[playerModel unloadFromGameCenter];
playerModel.hasGCStatus = TRUE;
[playerModel sync];
}
}];
}
localPlayer가 0이 아닌 것은 확실합니까? 핸들러가 호출되지 않은 iOS 버전에 대한 추측이 있습니까? 최종 버전인가, 베타 버전인가? iOS 7 베타 버전의 경우 Apple에 버그 신고서를 작성하십시오. 완성 처리기를 다른 곳으로 설정하지 않겠습니까? – Gougou
무슨 일입니까? 오류를 기록합니까, 아니면 아무것도 기록하지 않습니까? 게임 센터가 작동하지 않을 때 출력물이 무엇인지 알면 좋을 것입니다. – Binarian
@ Gougou 이것은 iOS 6에서 베타 버전이 아닌 내 지식을 최대한 활용하여 발생했습니다. –