0

我正在使用http://www.raywenderlich.com/5480/beginning-turn-based-gaming-with-ios-5-part-1上的教程

我有两个问题一直在努力解决。如果用户已登录,该应用程序可以正常工作。我想知道如果他们决定取消初始请求,如何重新检查/询问有关登录的信息。

这是在 appDelegate

  // At the top of the file
  #import "GCTurnBasedMatchHelper.h"

  // At the end of applicationDidFinishLaunching, right before 
  // the return YES
  [[GCTurnBasedMatchHelper sharedInstance] authenticateLocalUser];

我想在应用程序中这样做......

    if([GKLocalPlayer localPlayer].playerID]==nil)
    {
    [[GCTurnBasedMatchHelper sharedInstance] authenticateLocalUser];
    NSLog(@“Log them in!\n”);
    }
    else
    {
    NSLog(@“All set\n”);
    }

显然这不是要走的路……我该怎么做?

4

1 回答 1

0

I would make a function like that :

-(void)autentificateAgain{
    [[GCTurnBasedMatchHelper sharedInstance] authenticateLocalUser];
}

Now call it from a button... That should do the trick.

I hope it helps :-)

Greetings

Anselm

于 2012-05-15T01:49:40.230 回答