setConnectionState(_:completionHandler:)
Sets the connection state for the player.
Declaration
func setConnectionState(_ state: GKConnectionState, completionHandler: @escaping @Sendable ((any Error)?) -> Void)func setConnectionState(_ state: GKConnectionState) async throwsParameters
- state:
The
GKConnectionStateto be assigned to the player. - completionHandler:
A block that is called after the connect state has been set.
- error
If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is nil. See
GameKit Constantsfor a list of error codes specific to GameKit.
Discussion
This method will fail when the game session’s player limit has already been reached or there are network problems. The game session’s lastModifiedDate and lastModifiedPlayer properties are updated on completion.