I am developing a turn based game using GameKit. The happy path (pretty much as always) is fine; invite, accept, play, have winners/losers and match ends. Yay! But I am working on making sure I handle situations where invited friends decline to participate.
I've been through the docs, and don't see how the GKTurnBasedMatch
is updated to reflect the tap of the decline button in the Game Center Invite notification. When I reload the match from Game Center on the host device the status for the invitee who declined is still .invited.
I also tested by setting all players that are not the host in the nextParticipants of the endTurn(...)
to start the invites and the next invitee was not given a push notification to accept or decline the invite.
I feel like there should be a way to determine when an invitee has declined an invite (via participant in the match.participants via status OR a delegation method somewhere that is called when the Decline or Accept buttons on that notification are tapped.)
I'm missing something, please help me find it!
Thank you!
Further investigation shows that status of invited participants is .matching
until they accept in the push notification panel or take action leading to their turn being ended by calling endTurn(...)
. Tapping decline leads to a status for that participant of .invited
. If a player misses the push or otherwise ignores it, they remain .matching
.
So to answer my question: Participant States based on Actions WRT the Invite Message Game Center Push Notification:
.matching
is starting status.matching
remains after push is seen and ignored or otherwise missed..invited
if the user taps "Decline".active
if the user taps "Accept", even if they do not take any action in the app OR the app does something on the player's behalf.