iOS Developer Library

Developer

GameKit Framework Reference GKChallengeEventHandlerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

GKChallengeEventHandlerDelegate

Inherits From


Not Applicable

Conforms To


Import Statement


Not Applicable

Objective-C

@import GameKit;

Availability


Available in iOS 6.0 and later
Deprecated in iOS 7.0

You implement the GKChallengeEventHandlerDelegate delegate to control how challenges are displayed in your game.

By default, Game Kit briefly displays a banner over your game when any of the following events occur:

  • The local player receives a challenge.

  • The local player completes a challenge.

  • A remote player completes a challenge issued by the local player.

Your event handler can override or extend this behavior:

  • It can prevent a banner from being displayed.

  • It can be notified when a player taps in a banner.

  • It can handle the events directly.

  • Called when the local player selects a challenge banner displayed by Game Kit.

    Declaration

    Objective-C

    - (void)localPlayerDidSelectChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The selected challenge.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0

  • Called when the local player receives a new challenge.

    Declaration

    Objective-C

    - (void)localPlayerDidReceiveChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The received challenge.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0

  • Called to determine whether a banner should be shown when the local player receives a challenge.

    Declaration

    Objective-C

    - (BOOL)shouldShowBannerForLocallyReceivedChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The received challenge.

    Return Value

    Your delegate should return YEStrue if it wants a banner to be displayed. Otherwise it should return NOfalse.

    Discussion

    If you do not implement this method, a banner is always shown.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0

  • Called when the local player completes a challenge.

    Declaration

    Objective-C

    - (void)localPlayerDidCompleteChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The completed challenge.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0

  • Called to determine whether a banner should be shown when the local player completes a challenge.

    Declaration

    Objective-C

    - (BOOL)shouldShowBannerForLocallyCompletedChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The completed challenge.

    Return Value

    Your delegate should return YEStrue if it wants a banner to be displayed. Otherwise it should return NOfalse.

    Discussion

    If you do not implement this method, a banner is always shown.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0

  • Called when a remote player completes a challenge issued by the local player.

    Declaration

    Objective-C

    - (void)remotePlayerDidCompleteChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The completed challenge.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0

  • Called to determine whether a banner should be shown when a remote player completes a challenge.

    Declaration

    Objective-C

    - (BOOL)shouldShowBannerForRemotelyCompletedChallenge:(GKChallenge *)challenge

    Parameters

    challenge

    The completed challenge.

    Return Value

    Your delegate should return YEStrue if it wants a banner to be displayed. Otherwise it should return NOfalse.

    Discussion

    If you do not implement this method, a banner is always shown.

    Import Statement

    Objective-C

    @import GameKit;

    Availability

    Available in iOS 6.0 and later

    Deprecated in iOS 7.0