0

iOS 12.x Swift 4.2

Trying to update the GKScore using GameKit, but it failed with the error message, "error failed to update nil". The record I am trying to write as an authenticated user looks like this. I don't see any nil values.

ScoreReporter player:playerID:G:1572714306 alias:2004 friendLevel:FL6 rank:0 date:2018-12-21 14:15:32 +0000 value:400 formattedValue:(null) context:0x0 leaderboard:highScore group:(null)

The code it is running...

if GKLocalPlayer.local.isAuthenticated {
        var scoreReporter = GKScore(leaderboardIdentifier: "highScore")
        scoreReporter.value = Int64(scoreToSave)
        print("ScoreReporter \(scoreReporter)")
        var scoreArray: [GKScore] = [scoreReporter]
        GKScore.report(scoreArray) { (error) in
            print("error failed to update \(error?.localizedDescription)")
        }

Tried deleting and recreating highScore ID, but not helping... also tried deleting app on iPad, no working either.

When I go to Game Center, it reports "No Data Available"

user3069232
  • 8,587
  • 7
  • 46
  • 87

0 Answers0