I'm developing a turn-based game with iOS GameCenter. I use the default GKTurnBasedMatchmakerViewController for matchmaking and invites. However after sending and accepting an invite, the player:didAcceptInvite: method is not called. I expected that this method will be called after the other player has accepted the invite from the local player.
So my questions are:
1) How do you trigger player:didAcceptInvite:?
2) How do you inform the local player if the invite was declined?
I am targeting iOS 7+ and use two real devices for testing.
The following method will be called after the local player is authenticated:
-(void)onPlayerAuthenticationChanged
{
if ([GKLocalPlayer localPlayer].isAuthenticated)
{
if (!self.isLocalPlayerAuthenticated)
{
[[GKLocalPlayer localPlayer] registerListener:self];
self.isLocalPlayerAuthenticated = YES;
}
}
//…
}
The GC singleton conforms to the GKLocalPlayerListener protocol, which includes GKInviteEventListener and therefore player:didAcceptInvite:. My implementation looks roughly like the suggested solution in iOS 7: How to setup invitation handler for Game Center matchmaker.