nihalahmed / GameCenterManager

iOS Game Center helper singleton
Other
715 stars 127 forks source link

Critical Bug for saveScoreToReportLater #52

Closed danoli3 closed 9 years ago

danoli3 commented 9 years ago

Scores are never saved.

Critical and very serious bug.

Issue: In - (void)saveAndReportScore:(int)score leaderboard:(NSString *)identifier sortOrder:(GameCenterSortOrder)order {

if ([self checkGameCenterAvailability:NO] == YES) {

// ... EDITED OUT

#if TARGET_OS_IPHONE
        GKScore *gkScore = [[GKScore alloc] initWithLeaderboardIdentifier:identifier];
#else
#ifdef __MAC_10_10
        GKScore *gkScore = [[GKScore alloc] initWithLeaderboardIdentifier:identifier];
#else
        GKScore *gkScore = [[GKScore alloc] initWithCategory:identifier];
#endif
#endif
        // <<--------------- SCORE is never set for gkScore
        [self saveScoreToReportLater:gkScore];
    }

Fix: Add [gkScore setValue:score]; above [self saveScoreToReportLater:gkScore];

danoli3 commented 9 years ago

This leads to Sigfault in iOS 9 when trying to report [[GameCenterManager sharedManager] reportSavedScoresAndAchievements];

As GKScore has no value set (Error).

danoli3 commented 9 years ago

@nihalahmed Are you around mate? Going to PR this fix. Or @Sam-Spencer

Sam-Spencer commented 9 years ago

Fixed in commit b4d5c3c7f63c0500e9d992d8e5047793814a6dc7