Mac Developer Library

Developer

GameKit Framework Reference GKMatchmakerViewControllerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

GKMatchmakerViewControllerDelegate

A class implements the GKMatchmakerViewControllerDelegate protocol to receive notifications from a GKMatchmakerViewController object. The delegate is called if a new match has been successfully created, if the user cancels matchmaking, and if an error occurs. In all three cases, the delegate should dismiss the view controller.

Inheritance


Not Applicable

Import Statement


import GameKit @import GameKit;

Availability


Available in OS X v10.8 and later.
  • Called when a peer-to-peer match is found.

    Declaration

    Swift

    optional func matchmakerViewController(_ viewController: GKMatchmakerViewController!, didFindMatch match: GKMatch!)

    Objective-C

    - (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)match

    Parameters

    viewController

    The view controller that performed the matchmaking.

    match

    A completed match.

    Discussion

    This method is called when the view controller’s hosted property is NOfalse. 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.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.8 and later.

  • Called when a hosted match is found. (required)

    Declaration

    Swift

    optional func matchmakerViewController(_ viewController: GKMatchmakerViewController!, didFindHostedPlayers players: [AnyObject]!)

    Objective-C

    - (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindHostedPlayers:(NSArray *)players

    Parameters

    viewController

    The view controller that performed the matchmaking.

    players

    An array of GKPlayer objects containing the player identifier for the matched players.

    Discussion

    This method is called when the view controller’s hosted property is YEStrue. 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.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.10 and later.

  • Called when a hosted match is found.

    Declaration

    Swift

    optional func matchmakerViewController(_ viewController: GKMatchmakerViewController!, didFindPlayers playerIDs: [AnyObject]!)

    Objective-C

    - (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindPlayers:(NSArray *)playerIDs

    Parameters

    viewController

    The view controller that performed the matchmaking.

    playerIDs

    An array of NSString objects containing player identifier for the matched players.

    Discussion

    This method is called when the view controller’s hosted property is YEStrue. 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.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.8 and later.

    Deprecated in OS X v10.10.