Search code examples
iosgamekit

iOS - Text chat in GKTurnBasedMatch


I am trying to implement a chat feature in a turn-based match using GameKit. I think I can send the messages by calling [match endTurnWithNextParticipant:match.currentParticipant matchData:dataWithUpdatedChat completionHandler:...]

In other words, when I want to send a chat message, I end the current player's turn so that the data gets sent to Game Center, but then the current player is next to act so he can proceed normally.

However, I have no way of updating the match data if it is not the current player's turn. Is there any way to do this?


Solution

  • No, there is no way to do it. If there was it would be prone to race conditions between players. You need another service to implement a chat feature. Another option is to implement a limited chat in the game, for example an option to enter a message when ending the turn.