質問編集履歴
2
変更しました
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
【ios
|
1
|
+
【ios8版】GameCenterにスコアが表示されない
|
test
CHANGED
File without changes
|
1
質問内容を短縮
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
【ios7版】GameCenterにスコアが表示されない
|
test
CHANGED
@@ -1,117 +1,53 @@
|
|
1
|
-
ゲームのスコアを
|
1
|
+
iPhoneのゲームセンターですが、objective-cでゲームのスコアをゲームセンターに送る時
|
2
2
|
|
3
|
-
しかし、ログで確認するとゲームセンターにゲームスコアが渡っているようなのですが、
|
4
3
|
|
5
|
-
実際Xcodeのシミュレーター上のゲームセンターを見てみると「gamecenter no data available」で
|
6
4
|
|
7
|
-
|
5
|
+
以下のコードを書きました。
|
8
6
|
|
7
|
+
|
8
|
+
|
9
|
+
こちらを参考にしました。
|
10
|
+
|
9
|
-
|
11
|
+
http://qiita.com/s0hno/items/accf11c311e037c92302
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
そこで、MY_LEADERBOARD_IDの部分が何かがわかりません。
|
16
|
+
|
17
|
+
|
10
18
|
|
11
19
|
アドバイスをいただけると幸いです。
|
12
20
|
|
13
21
|
|
14
22
|
|
15
|
-
「ソースコード」
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
- (void)viewDidLoad {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
[super viewDidLoad];
|
24
|
-
|
25
|
-
// Do view setup here.
|
26
|
-
|
27
|
-
/**
|
28
|
-
|
29
|
-
* 画面を読み込む際の処理
|
30
|
-
|
31
|
-
*/
|
32
|
-
|
33
|
-
[self authenticateLocalPlayer];
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
//
|
23
|
+
//スコアをgamecenterへ送信
|
40
24
|
|
41
25
|
if ([GKLocalPlayer localPlayer].isAuthenticated) {
|
42
26
|
|
43
|
-
GKScore *scoreReporter=[[GKScore alloc] initWithLeaderboardIdentifier:@"L
|
27
|
+
GKScore *scoreReporter=[[GKScore alloc] initWithLeaderboardIdentifier:@"MY_LEADERBOARD_ID"];
|
44
28
|
|
45
29
|
scoreReporter.value = loadLocalInt;
|
46
30
|
|
47
31
|
NSArray *scorearray=[[NSArray alloc]initWithObjects:scoreReporter, nil];
|
48
32
|
|
33
|
+
NSLog(@"GAME CENTER : %ld",(long)loadLocalInt);
|
49
34
|
|
50
|
-
|
51
|
-
//ゲームセンターにデータが渡っているかログで確認
|
52
|
-
|
53
|
-
NSLog(@"GAME CENTER : %lld",scoreReporter.value);
|
35
|
+
NSLog(@"GAME CENTER2 : %lld",scoreReporter.value);
|
54
36
|
|
55
37
|
[GKScore reportScores:scorearray withCompletionHandler:^(NSError *error)
|
56
38
|
|
57
|
-
|
39
|
+
{
|
40
|
+
|
41
|
+
|
58
42
|
|
59
43
|
if (error)
|
60
44
|
|
61
45
|
{
|
62
46
|
|
63
|
-
NSLog(@"書き込めませんでした
|
47
|
+
NSLog(@"書き込めませんでした");
|
64
48
|
|
65
49
|
}
|
66
50
|
|
67
51
|
}];
|
68
52
|
|
69
53
|
}
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
/**
|
74
|
-
|
75
|
-
* ランキングボタンタップ時の処理
|
76
|
-
|
77
|
-
* リーダーボードを表示
|
78
|
-
|
79
|
-
*/
|
80
|
-
|
81
|
-
- (IBAction)test:(id)sender {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
GKGameCenterViewController *gcView = [GKGameCenterViewController new];
|
86
|
-
|
87
|
-
if (gcView != nil)
|
88
|
-
|
89
|
-
{
|
90
|
-
|
91
|
-
gcView.gameCenterDelegate = self;
|
92
|
-
|
93
|
-
gcView.viewState = GKGameCenterViewControllerStateLeaderboards;
|
94
|
-
|
95
|
-
[self presentViewController:gcView animated:YES completion:nil];
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
/**
|
104
|
-
|
105
|
-
* リーダーボードで完了タップ時の処理
|
106
|
-
|
107
|
-
* 前の画面に戻る
|
108
|
-
|
109
|
-
*/
|
110
|
-
|
111
|
-
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController
|
112
|
-
|
113
|
-
{
|
114
|
-
|
115
|
-
[self dismissViewControllerAnimated:YES completion:nil];
|
116
|
-
|
117
|
-
}
|