plugin com.apple.GameCenterUI.GameCenterDashboardExtension invalidated
I'm trying to get a simple high score system working in my game. I've followed all the tutorials online, and here is what I have right now.
When the user opens the app, I run this code (InitialViewController)
//initiate gamecenter
func authenticateLocalPlayer(){
let localPlayer = GKLocalPlayer.localPlayer()
localPlayer.authenticateHandler = {(viewController, error) -> Void in
if (viewController != nil) {
self.presentViewController(viewController!, animated: true, completion: nil)
}
else {
print((GKLocalPlayer.localPlayer().authenticated))
}
}
}
Then, after the user finishes their game, I report their score to Game Center using this function
//send high score to leaderboard
func saveHighscore(score:Int) {
// if player is logged in to GC, then report the score
if GKLocalPlayer.localPlayer().authenticated {
let gkScore = GKScore(leaderboardIdentifier: "ID_THAT_I_DOUBLE_CHECKED_MANY_TIMES")
gkScore.value = Int64(score)
GKScore.reportScores([gkScore], withCompletionHandler: { (error: NSError?) in
if (error != nil) {
// handle error
print("Error: " + error!.localizedDescription);
} else {
print("Score reported: \(gkScore.value)")
}
})
}
}
(I usually get the error here)
Not sure if this is important, but here is how i open the leaderboard and close it
//shows leaderboard screen
func showLeader() {
let vc = self
let gc = GKGameCenterViewController()
gc.gameCenterDelegate = self
vc.presentViewController(gc, animated: true, completion: nil)
}
//hides leaderboard screen
func gameCenterViewControllerDidFinish(gameCenterViewController: GKGameCenterViewController) {
gameCenterViewController.dismissViewControllerAnimated(true, completion: nil)
}
If I can be anymore specific, please comment below, I'm waiting by the computer.
Stack Overflows I've already refrenced
Here is the only output I see on the leaderboard:
Is there an alternative way to do this?
I have the same exact code for the leaderboards, and the same exact error. It was working fine for me over a week ago, and just recently I got the same error. I'm guessing the issue is on Apple's end. There might be a bug in Game Center at the moment. Hopefully it'll get fixed. Eventually.