Thanks to updates to the GameKit API in iOS 6, I can finally implement my turn-based board game the way it should be, complete with queue timeouts and better match-making software. However, I am facing a problem that I cannot solve. My desire is for Game Center to work completely invisible to the end user, so that everything is software based and uses my own user interfaces.
Therefore, I use my own native table view to display matches, and not the default GKTurnBasedMatchmakerViewController . Right now, I have no problem displaying open matches using the -loadMatchesWithCompletionHandler: method. I also use a custom screen to create a match, with direct creation for automatic matching (no problem) and a table view that loads Game Center friends for a local invitation application. Since the playersToInvite attribute playersToInvite now be populated with playerIDs, this is possible in iOS 6.
My main problem is processing the invitation on the recipient side. Suppose I invite Bob to play a game in a dual-player match. Now I canβt find a notification about a new invitation to Bob. -handleTurnEvent: only called for existing matches or by touching the banner (which I cannot guarantee that the user will do), and -handleInviteFromGameCenter: does nothing for me in this case.
The only way I discovered new invitations and thus update my custom game view controller is to call the -loadMatchesWithCompletionHandler: method and check for new matches in which the invited party's lastTurnDate is zero and against the existing array of open matches. I do this check every 10 seconds in the background since I cannot find the notification in the GKTurnBasedEventHandler that GKTurnBasedEventHandler called when a new invitation is received. Please, help!
EDIT: In the end, I just implemented the pull-to-refresh function. There is no way without a poll or any other method that would simply discard user data on their phone, so in my opinion, updating on demand is an ideal solution.
source share