开发者

Informing the user that a score was submitted to Game Center

开发者 https://www.devze.com 2023-02-17 19:49 出处:网络
Is there any method to tell the user that his score submitted successfully or j开发者_运维问答ust use an alert view.

Is there any method to tell the user that his score submitted successfully or j开发者_运维问答ust use an alert view.

I mean something like the Game Center welcome message: "Welcome Back, user"


Game Center score submission implements a block callback which you can use to handle errors or successful submission. 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.)


I mean something like the Game Center welcome message: "Welcome Back, user"

You can use GKNotificationBanner on iOS 5.

Have a look at the reference

0

精彩评论

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