ios7以上対応のアプリを作成する際にGameCenterを使用したのでメモ
ios7からなんか変わってしまっていた。
点数を送信する際のメモです
ios6まで
ios6.m
//最初にアプリ内でGameCenterにログインしておく
GKScore *scoreReporter=[[GKScore alloc] initWithCategory:@"カテゴリのID"];
scoreReporter.value = 100;//点数
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error) { /* エラー処理 */ }
}];
ios7
ios7.m
//最初にアプリ内でGameCenterにログインしておく
GKScore *scoreReporter=[[GKScore alloc] initWithLeaderboardIdentifier:@"カテゴリのID"];
scoreReporter.value = 100;//点数
NSArray *scorearray=[[NSArray alloc]initWithObjects:scoreReporter, nil];//入れたい点数を配列に入れる。
[GKScore reportScores:scorearray withCompletionHandler:^(NSError *error) {
if (error) { /* エラー処理 */ }
}];
簡単に言うと、少しAPIが変わって、1つ1つ送信するのではなく、配列で渡せるようになった。