From 43e474467b42f5e7c9b233380ef7729d79add4cb Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Thu, 25 Jun 2020 18:22:17 +0200 Subject: [PATCH] Introduce error logging for elo system --- GoldWars/GoldWars/EloHelper.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/GoldWars/GoldWars/EloHelper.swift b/GoldWars/GoldWars/EloHelper.swift index 7620a75..35d7287 100644 --- a/GoldWars/GoldWars/EloHelper.swift +++ b/GoldWars/GoldWars/EloHelper.swift @@ -55,12 +55,16 @@ class EloHelper { } static func reportScore(score: Int64) { - let gkScoreElo = GKScore(leaderboardIdentifier: EloHelper.IDENTIFIER_ELO, player: GameCenterManager.sharedInstance.localPlayer) + let gkScoreElo = GKScore(leaderboardIdentifier: EloHelper.IDENTIFIER_ELO, player: GKLocalPlayer.local) gkScoreElo.value = score - let gkScoreAll = GKScore(leaderboardIdentifier: EloHelper.IDENTIFIER_ALL_ELO, player: GameCenterManager.sharedInstance.localPlayer) + let gkScoreAll = GKScore(leaderboardIdentifier: EloHelper.IDENTIFIER_ALL_ELO, player: GKLocalPlayer.local) gkScoreAll.value = score GKScore.report([gkScoreAll, gkScoreElo], withCompletionHandler: { error in - os_log("New Scores reported to EloSystem", log: self.LOG, type: .info) + if error != nil { + os_log("Could not report %@", log: LOG, type: .error, error!.localizedDescription) + } else { + os_log("New Scores reported to EloSystem", log: self.LOG, type: .info) + } }) } }