I’m trying to get games center to work with, no luck. I’m using the Apple sample code.
When I go to view the leaderboard in the app, I see “unable to load” under the leaderboard in game center.
Things I’ve checked:
- My bundle ID on ITunesConnect is the same as in my info.plist
- That my Leaderboard is set up on iTunesconnect
- That my leaderboard ID is correctly entered into the code
- #import is included in the .m file
The code I have in my .h file:
int *scoreInt;
}
-(IBAction)subScore;
-(IBAction)showLeader;
Code in my .m file:
-(IBAction)subScore
{
{
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:@"1234567"] autorelease];
//in his tuturial value = scoreInt, not a label.
//try either i_StartPt or finalStarPt
scoreReporter.value = scoreInt;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
NSLog(@"failed!!!");
NSLog(scoreInt);
}
}];
}
}
-(IBAction)showLeader
{
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil)
{
leaderboardController.leaderboardDelegate = self;
[self presentModalViewController: leaderboardController animated: YES];
}
}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[self dismissModalViewControllerAnimated:YES];
}
Any suggestions would be fantastic! I’ve looked at similar errors on stackoverflow but I haven’t found a solution that has worked.
Chris
Have you signed in the local player?
Also check to make sure you’ve set everything up according to Apple’s Leaderboard Checklist.