0
我正在嘗試將遊戲中心功能添加到我的應用程序中,並且這個功能將用戶的高分添加到排行榜上。問題是它只上傳第一個高分。當用戶獲得新的高分時,我再次調用它,但它確實有效。快速遊戲中心保存高分功能不起作用
//send high score to leaderboard
func saveHighscore(score:Int)
{
//check if user is signed in
if GKLocalPlayer.localPlayer().authenticated
{
let scoreReporter = GKScore(leaderboardIdentifier: "774433bbcc11bbvv") //leaderboard id here
scoreReporter.value = Int64(circleView1.score) //score variable here (same as above)
let scoreArray: [GKScore] = [scoreReporter]
GKScore.reportScores(scoreArray,withCompletionHandler: {(error : NSError?) -> Void in
if error != nil
{
print("error")
}
})
}
}