问题
I have an iOS game with one Game Center leaderboard. Recently I published the game and it works fine with no issues. Then I did light version of the game and I'd like to use the same leaderboard for both games. I combined both versions of the game into the Game Center group and modified leaderboard ID, because Apple requires to start group leaderboard names with grp.
.
Now, if I load scores I receive nil. But if I firstly submit some score and load after that I receive only score for the local player. I checked the leaderboard on itunesconnect and I know for sure that there are a lot of records in the leaderboard. The leaderboard is the same as it was before combining into the group. I thought that Game Center needs some time to update, but I've waited about one day still see no changing.
So my question is why I received nil or score only for local player? Do I do something wrong? Or this is just a Game Center bug?
I found some similar issues here but the most recent one was posted about two years ago. Does anyone have any ideas? Any help appreciated!
Here is my code to load scores:
func loadScores(){
let leaderboard = GKLeaderboard()
leaderboard.identifier = "grp.myLeaderboardID"
leaderboard.loadScores { (scores, error) in
if error != nil {
print(error!.localizedDescription)
} else {
//do something with the scores
}
}
}
}
and to sumbit scores:
func submitScore(value: Int64) {
let leaderboardID = "grp.myLeaderboardID"
let sRating = GKScore(leaderboardIdentifier: leaderboardID)
sRating.value = value
GKScore.report([sRating], withCompletionHandler: { (error: Error?) -> Void in
if error != nil {
print(error!.localizedDescription)
}
})
}
UPDATE. The problem has gone suddenly. I think that the issue has been dealt with apple server bug but with combining into a group
来源:https://stackoverflow.com/questions/42994804/game-center-group-leaderboard-issue