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


class GKChallenge : NSObject


Players use the Game Center app to issue and view challenges. However, your game can also customize its challenge behaviors in a number of ways:

  • You can load the list of challenges issued to the local player by calling the loadReceivedChallenges(completionHandler:) class method. For example, you might do this to display the challenges in your game’s user interface.

  • Your app can issue challenges using a GKScore or GKAchievement object. Your game should only issue challenges when the local player initiates the action in your user interface.

Subclassing Notes

You never subclass the GKChallenge class directly. However, subclasses of GKChallenge represent specific kinds of challenges. Two challenge types exist:

  • A GKScoreChallenge is a challenge to beat a score the local player earned in a leaderboard.

  • A GKAchievementChallenge is a challenge to complete an achievement that the local player has already completed.


Retrieving the List of Challenges to the Local Player

Examining Details about a Challenge

var issuingPlayer: GKPlayer?

The GKPlayer object associated with the player who issued the challenge.

var receivingPlayer: GKPlayer?

The GKPlayer object associated with the player who received the challenge.

var message: String?

A text message that describes the challenge.

var state: GKChallengeState

The current state of the challenge.

enum GKChallengeState

Possible states that a challenge can live in.

var issueDate: Date

The date the challenge was issued.

var completionDate: Date?

The date the challenge was completed.

Declining a Challenge

func decline()

Declines a challenge.


typealias GKChallengeComposeCompletionBlock

Completion block that determines if a challenge has been issued and if so, who it is sent to.

Deprecated Properties

var issuingPlayerID: String?

The player who issued the challenge.

var receivingPlayerID: String?

The player who received the challenge.



Inherits From

See Also


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.

protocol GKChallengeListener

An object that responds to challenge events.