Game Center を利用するシンプルな iOS アプリがあります。しかし、最近iOS 7にアップデートしたところ、認証方法が機能しないことに気付きました。
問題の 1 つは、ユーザーがゲーム センターにサインインする必要がある場合にビュー コントローラーを表示するために使用しているコードにあり、アプリでゲーム センターのログイン ウィンドウがポップアップしなくなりました。
私が抱えている別の問題は、非推奨の「authenticateWithCompletionHandler」の代わりに使用するメソッドが見つからないことです。
これが私のコードです:
-(void)authenticateLocalUser {
GKLocalPlayer.localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error) {
if (GKLocalPlayer.localPlayer.authenticated) {
// Already authenticated
}
else if (viewController) {
[self presentViewController:viewController animated:YES completion:nil];
}
else {
// Problem with authentication, probably bc the user doesn't use Game Center.
}
};
if ([GKLocalPlayer localPlayer].authenticated == NO) {
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
[self callDelegateOnMainThread: @selector(processGameCenterAuth:) withArg:NULL error: error];
}];
}
}
時間をありがとう、ダン。