Platforms to show: All Mac Windows Linux Cross-Platform

Back to GameKitMBS class.

GameKitMBS.matchConnectionWithPlayerFailed(match as GKMatchMBS, playerID as string, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when the match fails to connect to a player.

match: The match that received the error.
player: The identifier for the player whose connection failed.
error: The error that occurred.

This method is called if the match was unable to send a transmission to another player in the match.

GameKitMBS.matchDidChangeState(match as GKMatchMBS, playerID as string, state as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when a player connects to or disconnects from the match.

match: The match that the player is connected to.
player: The identifier for the player whose state changed.
state: The state the player moved to. (see constants in GKMatchMBS)

Your game implements this method to be notified when players connect to or disconnect from the match.one

GameKitMBS.matchDidFailWithError(match as GKMatchMBS, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when the match cannot connect to any other players.

match: The match that received the error.
error: The error that occurred.

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.

GameKitMBS.matchDidReceiveData(match as GKMatchMBS, data as Dictionary, playerID as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when data is received from a player. (required)

match: The match that received the data.
data: The data sent by the player.
player: The string identifier for the player that sent the data.

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.

GameKitMBS.matchEnded(player as GKPlayerMBS, match as GKTurnBasedMatchMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 15.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when the match has ended. (required)

player: The GKPlayer object containing the current player’s information.
match: The GKTurnBasedMatch object containing the current game data.

Available in OS X v10.10 and later.

GameKitMBS.matchForInviteCompleted(Matchmaker as GKMatchmakerMBS, invite as GKInviteMBS, match as GKMatchMBS, error as NSErrorMBS, tag as Variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called by matchForInvite on completion.

Match provides the new match object on success.

Possible reasons for error:
1. Communications failure.
2. Invite cancelled.
Available on Mac OS X 10.8.2 and newer.

GameKitMBS.matchmakerViewControllerDidFailWithError(viewController as Variant, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when the view controller encounters an unrecoverable error. (required)

viewController: The view controller that received the error. (GKMatchmakerViewControllerMBS)
error: An error object that describes the error.

GameKitMBS.matchmakerViewControllerDidFindMatch(viewController as Variant, match as GKMatchMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when a peer-to-peer match is found.

viewController: The view controller that performed the matchmaking. (GKMatchmakerViewControllerMBS)
match: A completed match.

This method is called when the view controller's hosted property is false. Although optional in the protocol, if your game attaches a delegate to the view controller for a peer-to-peer match, the view controller expects your game to provide an implementation of this method.

GameKitMBS.matchmakerViewControllerDidFindPlayers(viewController as Variant, playerIDs() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when a hosted match is found.

viewController: The view controller that performed the matchmaking. (GKMatchmakerViewControllerMBS)
players: An array of identifier strings for the matched players.

This method is called when the view controller's hosted property is true. Although optional in the protocol, if your game attaches a delegate to the view controller for a hosted match, the view controller expects your game to provide an implementation of this method.

The view controller returns the list of players to your game by calling this method. Your game is responsible for connecting these players to your own server and then using that server to relay messages between the players.

GameKitMBS.matchmakerViewControllerDidReceiveAcceptFromHostedPlayer(viewController as Variant, playerID as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when a player in a hosted match accepts the invitation.

viewController: The view controller that accepted the invitation. (GKMatchmakerViewControllerMBS)
playerID: The identifier of the accepting player.

After a player accepts an invitation, that player's device should connect to your server. Once the connection is established, your game should call the view controller's setHostedPlayer method to update the player's connection status.

GameKitMBS.matchmakerViewControllerWasCancelled(viewController as Variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when the user cancels the matchmaking request (required)

viewController: The view controller that received the cancellation. (GKMatchmakerViewControllerMBS)

GameKitMBS.matchShouldReinvitePlayer(match as GKMatchMBS, playerID as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Called when a player in a two-player match was disconnected.

match: The match that lost the player.
playerID: The identifier for the player whose connection failed.

Your game should return true if it wants Game Kit to attempt to reconnect the player, false if it wants to terminate the match.

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 matchDidChangeState event is called when the other player is reconnected.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...