Protocol: GKMatchDelegate
Overview
The GKMatchDelegate protocol is implemented to receive status updates and network data from players connected to a GKMatch object.Called when the match cannot connect to any other players.Called when data is received from a player. (required)Called when a player connects to or disconnects from the match.Called when a player in a two-player match was disconnected.The state of another player in the match.
Instance Method Summary (collapse)
-
- match:didFailWithError:
Called when the match cannot connect to any other players.
-
- match:didReceiveData:fromPlayer:
Called when data is received from a player.
-
- match:player:didChangeState:
Called when a player connects to or disconnects from the match.
-
- match:shouldReinvitePlayer:
Called when a player in a two-player match was disconnected.
Instance Method Details
- (Object) match(match, didFailWithError:error)
Called when the match cannot connect to any other players. This method is called if the match cannot connect to any other players associated with the match. It usually means a serious networking error has occurred.
- (Object) match(match, didReceiveData:data, fromPlayer:playerID)
Called when data is received from a player. (required) Your game defines its own format for data packets it transmits and receives over the network.Important: Data received from other players should be treated as untrusted data. Be sure to validate the data you receive from the match and write your code carefully to avoid security vulnerabilities. See the Secure Coding Guide for more information.
- (Object) match(match, player:playerID, didChangeState:state)
Called when a player connects to or disconnects from the match. Your game implements this method to be notified when players connect to or disconnect from the match.
- (Boolean) match(match, shouldReinvitePlayer:playerID)
Called when a player in a two-player match was disconnected. Occasionally, players may get disconnected from a match. If your game implements this method in the match delegate and the match only contains two players, Game Kit calls this method after a player gets disconnected. If your delegate allows Game Kit to reconnect to the other player, it reconnects the other player. Your match:player:didChangeState: method is called when the other player is reconnected.