GKTurnBasedMatch Invitation Handling Without Game Center View Controllers

I'm working on a simple turn-based text game, and it's hard for me to determine how invitations work. When user A invites user B to the game, I want user B to see this game in my correspondence user interface (i.e., on the screen where all the games of user B are listed). All is well if user B clicks on the notification when he is invited to the game, but I still want the game to be visible through my own interface, if user B simply goes to the application on his own.

When this interface screen appears, I use [GKTurnBasedMatch loadMatchesWithCompletionHandler:]to get all matches of the local player. In this case, I would suggest that user B will be able to see the match to which he was invited, but this new match does not appear. If I accept the invitation through GKTurnBasedMatchmakerViewController, the user enters the game as expected, but what is even more puzzling is that if I open my own GKTurnBasedMatchmakerViewControllerand cancel without accepting the invitation, a new match will appear in my matching user interface, but it does not have enough matching data, that were sent by user A.

To summarize, I'm just wondering how to correctly display and accept invitations GKTurnBasedMatchusing a special interface (instead of using GKTurnBasedMatchmakerViewController). Thank!

+5
source share
2 answers

This question seems to be of interest to a couple of people, so here is an approximate approximation of what I was doing.

First of all, the reason why no new matches were shown at all was because I did not call [GKTurnBasedMatch loadMatchesWithCompletionHandler:]every time I wanted the performance to be updated as if I were. So, I do not remember that there is no real problem.

, GKTurnBasedMatch, (.. ) . , [GKTurnBasedMatch loadMatchesWithCompletionHandler:], , GKTurnBasedMatch. , , [match loadMatchDataWithCompletionHandler:], , [GKTurnBasedMatch loadMatchesWithCompletionHandler:] ( match GKTurnBasedMatches). , , NSData. NSData, , , .

, loadMatchDataWithCompletionHandler GKTurnBasedMatch, , .

0

UPDATE: .

. . , , :

Game Center . , .

GKLocalPlayerListener , :

player(_ player: GKPlayer, receivedTurnEventFor match: GKTurnBasedMatch, 
       didBecomeActive: Bool)

, , , . .

:

, , , - :

  • . , Game Center . , , . №2.
  • , (, , playerJake Foo), , loadMatches, . -, Game Center , .
  • , , , acceptInvite(...) . , playerJake , loadMatches, , matchFoo , playerJake matchFoo.acceptInvite( /* ...completion handler stuff here... */), playerJake .

. , !

0

All Articles