开发者

score submittion failure

I am receiving always a Failure in my cocos2d, but when I run this project in my view based application then it will give me succ开发者_如何学JAVAess, and the score will easily submitted

[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error){
    if (error ==nil) {
        NSLog(@"Success");
    } else {
        NSLog(@"Fail");
    }   
}];


GKScore *myScoreValue = [[[GKScore alloc] initWithCategory:@"123"] autorelease];
myScoreValue.value =  lastScore;

[myScoreValue reportScoreWithCompletionHandler:^(NSError *error){
    if(error != nil){
        NSLog(@"Score Submission Failed");
    } else {
        NSLog(@"Score Submitted");
    }

}];


I had this error, too. I think it happens when you're logged into a regular gamecenter acct and try to autenticate with an app that needs to be sandboxed. But I'm not sure of that, that's just a guess.

What worked for me was to go and log out with the Game Center app, and then try the app again, and that will login or create a sandboxed user.

Not the most descriptive error message ever though.


Have you added the GameKit framework, and also; where have you placed the code?

[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error){ if (error ==nil) { NSLog(@"Success"); } else { NSLog(@"Fail"); }

}];

You have to authenticate when the user starts the app, or when the viewDidLoad function is called.

I don't think I really understand what your problem is. What warnings do you geT?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜