Reputation: 21
I am new to Swift (and coding in general) and have experienced an issue when uploading a score to the GameKit Leaderboard. I can see all users in the leaderboard, but the score is always "0". This is the error I am getting in the console:
["$s7Combine10PublishersO8SequenceV7receive10subscriberyqd___t7FailureQyd__Rs_AA10SubscriberRd__5InputQyd__7ElementRtzlF +1012", "$s7Combine9PublisherPAAE9subscribeyyqd__AA10SubscriberRd__7FailureQyd__AFRtz5InputQyd__6OutputRtzlF +1060", "_dispatch_call_block_and_release +32", "_dispatch_client_callout +20", "_dispatch_main_queue_callback_4CF +1000", "CFRunLoopRunSpecific +600", "GSEventRunModal +164", "UIApplicationMain +168", "$s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF +104", "$sSo21UIApplicationDelegateP5UIKitE4mainyyFZ +120", "$s10PlantATree11AppDelegateC5$mainyyFZ +48", "main +32"]
How I have been trying to update my scores:
func updateScore(with value: Int) {
let score = GKScore(leaderboardIdentifier: "bp")
score.value = Int64(value)
GKScore.report([score]) { (error) in
if error != nil{
print("Updated score successfully. ")
}
}
}
updateScore(with: score)
Is there a way to fix this?
Upvotes: 2
Views: 296