Posting a Score

Before a leaderboard provides any useful functionality, we need to populate it with some score data. We begin this process by modifying our GameCenterManager class once again. Add the following method to the implementation; it should look very familiar as it follows the same pattern that we used when we implemented the authentication methods.

- (void) reportScore: (int64_t) score forCategory: (NSString*) category {         GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] images autorelease];         scoreReporter.value = score;         [scoreReporter report        ScoreWithCompletionHandler: ^(NSError *error)         { ...

Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.