teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コードを修正しました

2015/11/03 13:18

投稿

ababab
ababab

スコア47

title CHANGED
File without changes
body CHANGED
@@ -19,16 +19,16 @@
19
19
  #import <Social/Social.h>
20
20
 
21
21
  -(void)score{
22
+ if ([GKLocalPlayer localPlayer].isAuthenticated) {
22
- GKScore *scoreReporter = [[GKScore alloc] initWithCategory:@"itunes connectで作ったLeaderboard ID"];
23
+ GKScore* score = [[GKScore alloc] initWithLeaderboardIdentifier:@"achievement"];
23
- NSInteger scoreR;
24
+
24
- scoreR=スコアの値;
25
- scoreReporter.value = scoreR;
25
+ score.value = 100.0;
26
- [scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
26
+ [GKScore reportScores:@[score] withCompletionHandler:^(NSError *error) {
27
- if (error != nil)
27
+ if (error) {
28
- {
29
- // 報告エラーの処理
28
+ // エラーの場合
30
- NSLog(@"error %@",error);
31
29
  }
32
30
  }];
31
+ }
32
+
33
33
  }
34
34
  ```