[英]Informing the user that a score was submitted to Game Center
Is there any method to tell the user that his score submitted successfully or just use an alert view. 是否有任何方法可以告诉用户他的分数已成功提交,或者仅使用警报视图。
I mean something like the Game Center welcome message: "Welcome Back, user" 我的意思是类似Game Center的欢迎消息:“欢迎回来,用户”
Game Center score submission implements a block callback which you can use to handle errors or successful submission. Game Center分数提交实现了一个块回调,可用于处理错误或成功提交。 This is a function copied directly from the developer documentation: 这是直接从开发人员文档中复制的函数:
- (void) reportScore: (int64_t) score forCategory: (NSString*) category{
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] autorelease];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil){
//There was an error submitting the score.
}else {
//The score was successfully submitted.
}
}];
}
In terms of the user interface, like the sliding "welcome back" view, you'll have to make your own user interface for that. 在用户界面方面,就像滑动的“欢迎回来”视图一样,您必须为此创建自己的用户界面。 (I just use UIAlertview
, but that's totally up to you.) (我只是使用UIAlertview
,但这完全取决于您。)
I mean something like the Game Center welcome message: "Welcome Back, user" 我的意思是类似Game Center的欢迎消息:“欢迎回来,用户”
You can use GKNotificationBanner on iOS 5. 您可以在iOS 5上使用GKNotificationBanner。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.