I'm implementing my first Turn Based game with Game Center, and I'm having a difficult time understanding who receives the notification from
player(_:wantsToQuitMatch:)
.
Does the current player who is quitting (via some in-game quitting method) get this notification? Do other players get the notification when the current player quits? What happens if the current player quits from within Game Center (removes the game)?
I've tried removing a game in Game Center, when it's my turn, and the method doesn't get triggered for the players still in the game. I can't get that method to trigger.
After several years of working with GKTurnBasedMatch
, I have Never seen wantsToQuitMatch
fire. Never. Not once.
The (massively overloaded) function, receivedTurnEventForMatch
is the only function that will fire when a player joins or leaves. (See my answer at https://stackoverflow.com/a/34458493/1641444 for more information about when each of the functions fire). It's a pain because receivedTurnEventForMatch
fires in many difference circumstances and it's left up to you to decipher which one triggered it.
This wasn't your question, but as you're just starting out with turn based matches, if you're not too heavily invested yet, I suggest you consider the new GKGameSession
announced at WWDC this year. GKTurnBasedMatch
has numerous constraints that can leave games stranded (can't be continued by any player). I'm just beginning to look into Game Sessions myself; however, at first glance, they give you much greater control plus a significantly larger match data object (512kB vs 64kB).