Game Center Group Leaderboard issue

懵懂的女人 提交于 2019-12-11 06:58:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!