gpt4 book ai didi

iphone - 高分提交到游戏中心不起作用

转载 作者:行者123 更新时间:2023-12-03 19:44:21 24 4
gpt4 key购买 nike

我正在做一个基于数学的ios应用程序..我已经完成了将高分上传到游戏中心的代码。但这不起作用..它总是显示 0 作为最高分.. 这是我的代码...

[[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");
}

}];
}

最佳答案

我认为您的方法需要使用int64_t!我使用这个方法,效果非常好:-)

-(void)submitScore:(int64_t)score category:(NSString*)category{

GKScore *gkScore = [[[GKScore alloc]initWithCategory:category]autorelease];
gkScore.value = score;

[gkScore reportScoreWithCompletionHandler:^(NSError* error)
{
[self setLastError:error];
bool sucess = (error == nil);
[delegate onScoresSubmitted:sucess];

}];
}

问候

安瑟姆

关于iphone - 高分提交到游戏中心不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10652624/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com