I am making a math based ios application. I made code to upload high marks to Game Center. but it does not work. it always shows 0 as a 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);
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");
}
}];
}
source
share