私はこのスコアをゲームセンターに提出しますが、スコアを0にする度にスコアが0になります。これはどうだった?私もGameKitフレームワークをインポートしました。私はXcodeの以前のバージョンからのチュートリアルをいくつか見てきましたが、違いがあれば分かりません。GameCenter - ゲームセンターにスコアを提出するためのコードが動作しない - Xcode - iOS
-(IBAction)submitScore{
if (highscore>0) {
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:@"MyLeaderBoardID"] autorelease];
scoreReporter.value = [[NSNumber numberWithInt:highscore] longLongValue];
NSLog(@"posted");
NSLog(@"%i",highscore);
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
NSLog(@"failed!!!");
NSLog(@"%i",highscore);
}
else{
NSLog(@"Succeded");
}
}];}
私はまた、署名するためのコードを持っている:
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error){
if (error == nil) {
NSLog(@"authintication success");
}
else{
NSLog(@"authintication failed");
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Game Center Disabled"message:@"For Game Center make sure you have an account and you have a proper device connection."delegate:self cancelButtonTitle:@"Ok"otherButtonTitles:nil];
[alert show];
}
}]。
self.currentLeaderBoard = @"MyLeaderBoardID";
どのようにこれは2012年5月に提供さ答えは異なるのですか? – EWit