2012-09-27 45 views
0

我已啓用Game Center在我的iTunes連接我的應用程序。 在我的遊戲中心,我創建了一個名爲「Level 1」的ID爲「level1」的整數排行榜。問題提交得分給排行榜

在我的比賽,我試圖提出這樣的分數:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; 

    GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:@"level1"] autorelease]; 

    int64_t score1 =scr; 
    scoreReporter.value = score1; 
    [scoreReporter reportScoreWithCompletionHandler:^(NSError *error) { 
     if (error != nil) { 
      NSLog(@"Submit failed"); 
     } 
     else { 
      NSLog(@"Score Submited"); 
     } 
    }]; 

    [pool release]; 

,但我得到一個提交失敗;我已經在30-40分鐘之前創建了排行榜,可以通過蘋果啓用嗎?如果沒有,我不知道我做錯了什麼。

這是我的錯誤:

Error: Error Domain=GKErrorDomain Code=6 "The requested operation could not be completed because local player has not been authenticated." UserInfo=0x1ed4d4a0 {NSLocalizedDescription=The requested operation could not be completed because local player has not been authenticated.}

順便說一句,我有我的iphone上網和我連我的手機上一個蘋果賬號

+0

你試過讀錯誤?描述是什麼? –

+0

@AdamSwinden我更新了文字 – Alex

回答

0

在遊戲中心不是authentificated,現在的作品!從Game Center Programming Guide

例子:

- (void) authenticateLocalPlayer 
{ 
    GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; 
    [localPlayer authenticateWithCompletionHandler:^(NSError *error) { 
     if (localPlayer.isAuthenticated) 
     { 
      // Player was successfully authenticated. 
      // Perform additional tasks for the authenticated player. 
     } 
    }]; 
}