ターンベースのゲームにイベントリスナーを実装して、プレイヤーが自分のターンがアクティブになったとき、または友人から招待されたときに受け取ることができるようにしようとしていました。GKTurnBasedEventHandler は IOS 7 で廃止され、GKLocalPlayerListener を使用する必要があるというドキュメントを読みました。しかし、それはその延長です。どこにも情報がないので、すでに使っている人はいますか?
これは私が以前に試したもので、うまくいきません。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error)
{
if (localPlayer.isAuthenticated)
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer registerListener:self];
}
}];
return YES;
}
-(void)handleInviteFromGameCenter:(NSArray *)playersToInvite
{
NSLog(@"test");
}
- (void)player:(GKPlayer *)player receivedTurnEventForMatch:(GKTurnBasedMatch *)match didBecomeActive:(BOOL)didBecomeActive
{
NSLog(@"test");
}