7

GameCenterでGKLocalPlayerを認証しようとしています。ただし、Appleが提供するコード

- (void) authenticateLocalPlayer
{
    [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
         if (error == nil)
         {
              // Insert code here to handle a successful authentication.
              NSLog(@"Logged in.");
         }
         else
         {
             // Your application can process the error parameter to report the error to the player.
             NSLog(@"%@", [error description]);
         }
     }];
}

私のためにトリックをしていないようです。「GameCenterサーバーに接続できませんでした」というアラートが常に表示されます。「再試行」または「キャンセル」のオプションがあります。どちらのNSLogステートメントも実行されないので、completionHandlerも起動されないと思います。

再試行を押すと、次のエラーが発生します。

Error Domain=GKErrorDomain Code=7 "The requested operation could not be completed because local player is already authenticating." UserInfo=0x8915f80 {NSLocalizedDescription=The requested operation could not be completed because local player is already authenticating.}

誰が何が悪いのか分かりますか?

4

3 に答える 3

7

One possible problem I found with connecting to Game Center is that your date may be wrong on the device. Check if your date is the actual current date. Somehow Game Center does not allow connections from devices with incorrect dates.

于 2011-01-11T19:40:25.450 に答える
1

シミュレータを完全にデフォルトにリセットしようとする場合があります。それは私のために働きました、それがリセットされると、私のiDeviceは再び働きます。

ログインできなかったiOSのバージョンによっては、シミュレーターをフォアグラウンドに設定して左上に移動します。iOSシミュレータ->コンテンツと設定のリセット->リセットボタンをクリックします。

これがお役に立てば幸いです。

于 2013-04-11T17:40:03.663 に答える
0

ここでもまったく同じ問題があります。昨日の朝、5回に1回くらいは効きました。今日、私は一度もGame Centerサンドボックスにログインできませんでした(あなたが投稿したのと同じコードを使用して)。

編集:展開ターゲットを3.0に変更しました「プロジェクト-アクティブターゲットの編集-iOS展開ターゲット」

次に、アクティブな実行可能ファイルに4.1シミュレーターを選択でき、ログインでき、すべてが機能します。私が推測する4.2サンドボックスの何か...

于 2010-09-20T00:16:35.827 に答える