1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GameCenter

Last updated at Posted at 2012-07-29

設定

iTunes Storeでアプリを登録する

実装

プレーヤー情報を取得する

  • App ID作成
  • Provisioning -> DistributionでProfileを作成する
    • 作成したらキーチェーンアクセスを起動してそこに鍵を登録させる
AppDeligate.m
#import <GameKit/GameKit.h>

    // GameCenterのプレイヤー情報を取得
    [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error){}];

得点送信

GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category]
autorelease];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
            // 報告エラーの処理
}
}];

テストユーザTips

  • ユーザは新規に作成しておいたほうが無難。どうも既存ユーザはだめっぽい

リファレンス

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?