GKChallengeEventHandlerDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/GameKit.framework
Availability
Available in iOS 6.0 and later.
Deprecated in iOS 7.0.
Companion guide
Declared in
GKChallengeEventHandler.h

Overview

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:

Your event handler can override or extend this behavior:

Tasks

Detecting When a User Taps a Banner

Responding When a New Challenge Is Received

Responding to Challenges Completed By the Local Player

Responding to Challenges Issued by the Local Player

Instance Methods

localPlayerDidCompleteChallenge:

Called when the local player completes a challenge.

- (void)localPlayerDidCompleteChallenge:(GKChallenge *)challenge
Parameters
challenge

The completed challenge.

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h

localPlayerDidReceiveChallenge:

Called when the local player receives a new challenge.

- (void)localPlayerDidReceiveChallenge:(GKChallenge *)challenge
Parameters
challenge

The received challenge.

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h

localPlayerDidSelectChallenge:

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

- (void)localPlayerDidSelectChallenge:(GKChallenge *)challenge
Parameters
challenge

The selected challenge.

Discussion

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h

remotePlayerDidCompleteChallenge:

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

- (void)remotePlayerDidCompleteChallenge:(GKChallenge *)challenge
Parameters
challenge

The completed challenge.

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h

shouldShowBannerForLocallyCompletedChallenge:

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

- (BOOL)shouldShowBannerForLocallyCompletedChallenge:(GKChallenge *)challenge
Parameters
challenge

The completed challenge.

Return Value

Your delegate should return YES if it wants a banner to be displayed. Otherwise it should return NO.

Discussion

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

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h

shouldShowBannerForLocallyReceivedChallenge:

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

- (BOOL)shouldShowBannerForLocallyReceivedChallenge:(GKChallenge *)challenge
Parameters
challenge

The received challenge.

Return Value

Your delegate should return YES if it wants a banner to be displayed. Otherwise it should return NO.

Discussion

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

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h

shouldShowBannerForRemotelyCompletedChallenge:

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

- (BOOL)shouldShowBannerForRemotelyCompletedChallenge:(GKChallenge *)challenge
Parameters
challenge

The completed challenge.

Return Value

Your delegate should return YES if it wants a banner to be displayed. Otherwise it should return NO.

Discussion

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

Availability
  • Available in iOS 6.0 and later.
Declared In
GKChallengeEventHandler.h