I’m doing an ios app based on maths..
I’ve done the code for uploading the high score to the Game Center..
but this doesn’t work..
it’s always showing 0 as the high score..
This is my code…
[[GKLocalPlayer localPlayer]authenticateWithCompletionHandler:^(NSError *error)
{
if (error ==nil)
{
CCLOG(@"Success");
} else
{
CCLOG(@"Fail");
}
}];
.
.
.
.
.
-(void)showLeaderboard
{
if( ! gameCenterViewController_ )
gameCenterViewController_ = [[GameCenterViewController alloc] init];
[gameCenterViewController_ showLeaderboard];
}
-(void)submitMyScore1:(int)score1
{
CCLOG(@"submitMyScore1--%d",score1);
//This is the same category id you set in your itunes connect GameCenter LeaderBoard
GKScore *myScoreValue = [[[GKScore alloc] initWithCategory:@"bigwizlist"] autorelease];
myScoreValue.value = score1;
[myScoreValue reportScoreWithCompletionHandler:^(NSError *error){
if(error != nil)
{
CCLOG(@"Score Submission Failed");
} else
{
CCLOG(@"Score Submitted");
}
}];
}
I think you need to use an int64_t for your method! I use this method and it works perfectly fine 🙂
Greetings
Anselm