Note that there are some explanatory texts on larger screens.

plurals
  1. POHandling Invitations for Programmatic Turn-Based Game
    primarykey
    data
    text
    <p>Thanks to the updates to GameKit API in iOS 6, I am finally able to implement my turn-based board game the way it should be, complete with turn timeouts and better programmatic creation of matches. However, I am running into an issue that I cannot seem to solve. My desire is to have Game Center running entirely invisible to the end-user, so that everything is programmatic and uses my own custom interfaces.</p> <p>Therefore, I use my own custom table view to display matches, not the default <code>GKTurnBasedMatchmakerViewController</code>. Right now, I have no problem displaying open matches using the <code>-loadMatchesWithCompletionHandler:</code> method. I also use a custom screen to create a match, with a direct creation for auto-match (not a problem) and a table view that loads Game Center friends of the localPlayer for invitation. Since the <code>playersToInvite</code> attribute can now be filled with playerID's, this is possible in iOS 6.</p> <p>My main problem is handling the invitation on the recipient's side. Lets say I invite Bob to play my game in a two-player match. Right now I can't seem to find a notification for a new invite on Bob's end. The <code>-handleTurnEvent:</code> only gets called for existing matches or if the banner notification is touched (which I can't guarantee the user will do), and <code>-handleInviteFromGameCenter:</code> does nothing for me in this case.</p> <p>The only way I have come up with to detect new invites and thus update my custom game view controller is to call the <code>-loadMatchesWithCompletionHandler:</code> method and check for new matches in which lastTurnDate of the invited participant is nil and against an existing array of open matches. I run this check about every 10 seconds in the background since I can't find a notification in <code>GKTurnBasedEventHandler</code> that is called when a new invite is received. Please help!</p> <p>EDIT: In the end, I have just implemented a pull-to-refresh functionality. There is no way without implementing polling or some other method that would just waste the user's data on their phone, so on demand refreshing is the most ideal solution in my opinion.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload