So I have a finished game, which I'm just tidying up before submitting to the App Store.
Since I finished the majority of the coding, I've updated xCode to 7.1.1 and my device to iOS 9.1 from 8.1.
The first thing I've learnt is there's no Sandbox toggle in Game Center (which is what I've mostly always used with no problems)
Now, when I run the application, when it comes to reporting a score using this code:
-(void)reportScore{
GKScore *this_score = [[GKScore alloc] initWithLeaderboardIdentifier:_leaderboardIdentifier];
this_score.value = gameScore;
[GKScore reportScores:@[this_score] withCompletionHandler:^(NSError *error) {
if (error != nil) {
NSLog(@"%@", [error localizedDescription]);
}
}];
NSLog(@"Reported to Game Center...");
}I get this error printed to the console:
*** Terminating app due to uncaught exception 'GKInvalidArgumentException', reason: 'A GKScore must specify a leaderboard.'
*** First throw call stack:
(0x184e60f48 0x199a13f80... ...0x1000d9748... ...0x19a2628b8)
libc++abi.dylib: terminating with uncaught exception of type NSExceptionwhich states, a `GKScore` must specify a `leaderboard`...
I'm confused, because up until I updated to iOS 9, this worked fine.
I've been reading a bunch about the merging of sandbox in iOS 9, but I don't understand all of it.
From what I can gather, it's merged into real-life accounts, all sandbox data is deleted and testing is done on real leaderboards? I may be wrong. Like I said, I'm not 100% about this.
How can I solve this problem?
Maybe I need to specify my LeaderboardIdentifier locally?
**UPDATE**
This is even worse than I thought...
Some of my apps that are in the App Store now crash when trying to open/submit to Game Center when the player dies and a score is trying to be submitted...?
I only just thought to test them since reading this
Is there a cleaner or more updated method of implementing Game Center?