Protocol

GKChallengeListener

An object that responds to challenge events.

Declaration

protocol GKChallengeListener

Overview

Your app can ignore a challenge, start up in a specific state so the player can respond to a challenge, or notify the original challenger when the local player completes a challenge.

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

Topics

Responding to a Challenge

func player(GKPlayer, didReceive: GKChallenge)

Called when a player receives a challenge and doesn’t want to address it immediately.

func player(GKPlayer, wantsToPlay: GKChallenge)

Called when a player wants to start a game with the intention of completing a challenge.

Completing a Challenge

func player(GKPlayer, didComplete: GKChallenge, issuedByFriend: GKPlayer)

Called when the player completes a challenge that was issued by a friend.

func player(GKPlayer, issuedChallengeWasCompleted: GKChallenge, byFriend: GKPlayer)

Called when a friend completes a challenge that was sent to them by the player.

Relationships

Inherits From

See Also

Challenges

class GKChallenge

An object representing a challenge issued by the local player to another player.

class GKScoreChallenge

An object representing a challenge based on a score in a leaderboard.

class GKAchievementChallenge

A challenge sent to another player urging them to complete a specific achievement.