Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 游戏中心提交不工作_Ios_Submit_Game Center - Fatal编程技术网

Ios 游戏中心提交不工作

Ios 游戏中心提交不工作,ios,submit,game-center,Ios,Submit,Game Center,我有一个应用程序,正在尝试向游戏中心提交分数。这是我的代码: - (IBAction) submitScore{ NSString *show = [[NSString alloc] initWithFormat:@"Note: Scores may take some time to update"]; self.note.text = show; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Submitted"

我有一个应用程序,正在尝试向游戏中心提交分数。这是我的代码:

- (IBAction) submitScore{

NSString *show = [[NSString alloc] initWithFormat:@"Note: Scores may take some time to update"];
self.note.text = show;

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Submitted"
                                                message:@"Your score has been submitted to the Gamecenter leaderboard"
                                               delegate:nil
                                      cancelButtonTitle:@"OK"
                                      otherButtonTitles: nil];
[alert show];


array = [NSMutableArray arrayWithContentsOfFile:Path];


NSString *s = [[NSNumber numberWithInteger:[array count]] stringValue];
NSString *denom = [NSString stringWithFormat: @"%d", 15];;
double resultInNum;
double sdouble = [s doubleValue];
double denomdouble = [denom doubleValue];



resultInNum = sdouble/denomdouble * 100;

if(resultInNum > 0)
{
    self.currentLeaderBoard = kLeaderboardID;

    [self.gameCenterManager reportScore: resultInNum forCategory: self.currentLeaderBoard];
    Submit.enabled = NO;



}
array = [NSMutableArray arrayWithContentsOfFile:Path];



[array writeToFile:Path atomically:YES];
NSLog(@"Count: %i", [array count]);
}
但是,当我尝试这样做时,它不会提交给领导委员会。我在调试器中没有收到任何错误,在我添加多个领导板之前,调试器一直有效。这里怎么了?

分数值必须是int64\t


我不明白你为什么使用NSStrings而不是直接赋值?

只要确保提交分数时使用正确的代码即可。这是我非常喜欢的一种方式。即使你会收到警告,因为他们不希望你在iOS 7中使用它,但它仍然有效。如果不行就告诉我

(iAction)提交CoretoGameCenter{

GKLocalPlayer *localplayer = [GKLocalPlayer localPlayer];
[localplayer authenticateWithCompletionHandler:^(NSError *error) {

}];
//This is the same category id you set in your itunes connect GameCenter LeaderBoard
GKScore *myScoreValue = [[[GKScore alloc] initWithCategory:@"insertCategory"] autorelease];
myScoreValue.value = scoreInt;

[myScoreValue reportScoreWithCompletionHandler:^(NSError *error){

    //insert what happens after it's posted 

}];
[self checkAchievements];

}

我把它做成了一个int64\t,但它仍然不起作用,我不知道为什么要使用nsstrings