Mac Developer Library

Developer

GameKit Framework Reference GKInviteEventListener Protocol Reference

Options
Deployment Target:

On This Page
Language:

GKInviteEventListener

Handles invite invite events form Game Center. You can invite other players and start your game from directly from Game Center. Accepting an invitation begins the game from Game Center with the accepting player assigned a spot in the game.

Do not implement GKInviteEventListener directly, instead use GKLocalPlayerListener. The GKLocalPlayerListener protocol inherits methods from GKInviteEventListener, GKChallengeListener, and GKTurnBasedEventListener in order to handle multiple events.

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import GameKit

Objective-C

@import GameKit;

Availability


Available in OS X v10.10 and later.
  • Called when another player accepts a match invite from the local player. (required)

    Declaration

    Swift

    optional func player(_ player: GKPlayer!, didAcceptInvite invite: GKInvite!)

    Objective-C

    - (void)player:(GKPlayer *)player didAcceptInvite:(GKInvite *)invite

    Parameters

    player

    The GKPlayer object that identifies the player associated with the invitation.

    invite

    The invitation accepted by the player.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in OS X v10.10 and later.

  • Called when the local player starts a match with another player from Game Center. (required)

    Declaration

    Swift

    optional func player(_ player: GKPlayer!, didRequestMatchWithRecipients recipientPlayers: [AnyObject]!)

    Objective-C

    - (void)player:(GKPlayer *)player didRequestMatchWithRecipients:(NSArray *)recipientPlayers

    Parameters

    player

    The GKPlayer object that identifies the player associated with the invitation.

    recipientPlayers

    An array of GKPlayer objects containing the player identifiers invited to the match.

    Discussion

    When this method is called, the game is launched from Game Center and starts the matchmaking process.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in OS X v10.10 and later.