I am trying to submit a float
of two decimal length to my Game Center leaderboard, however the only format allowed to submit with is int64_t
. I am using the default Apple report score method:
- (void)reportScore:(int64_t)score forCategory:(NSString *)category {
GKScore *scoreReporter = [[GKScore alloc] initWithCategory:category];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler: ^(NSError *error) {
[self callDelegateOnMainThread: @selector(scoreReported:) withArg: NULL error: error];
}];
}
I am trying to use this method to provide the score to the report score method:
- (IBAction)increaseScore {
self.currentScore = self.currentScore + 1;
currentScoreLabel.text = [NSString stringWithFormat: @"%lld", self.currentScore];
NSLog(@"%lld", self.currentScore);
}
Please help, I have been googling like crazy and cannot find the answer to this.
You can only submit 64 bit integers as scores to a leaderboard. From the documentation:
That doc page should tell you about formatting your score. It sounds like in order to display float-like scores you will have to tinker with the format settings in iTunes Connect.
Update
Try this for increaseScore: