Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

GKChallengeMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class GameKit MBS MacFrameworks Plugin 13.0 Yes No No Yes, macOS only No
Function: A GKChallenge object represents a challenge issued by a player to another player.
Important: Your game must authenticate a local player before you can use any Game Center classes. If there is no authenticated player, your game receives a GKErrorNotAuthenticated error. For more information on authentication see Game Center Programming Guide.

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 shared method. For example, you might do this to display the challenges in your game's user interface.
  • Your app can issue challenges using a GKScoreMBS or GKAchievementMBS object. Your game should only issue challenges when the local player initiates the action in your user interface.
  • Your game can be notified when new challenge events are received. See GameKitMBS events.

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

A GKScoreChallengeMBS is a challenge to beat a score the local player earned in a leaderboard.
A GKAchievementChallengeMBS is a challenge to complete an achievement that the local player has already completed.

Available on Mac OS X 10.8.2 and newer.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Feedback, Comments & Corrections

State Constants

Constant Value Description
GKChallengeStateCompleted 2 The receiving player successfully completed the challenge.
Available on Mac OS X 10.8.2 and newer.
GKChallengeStateDeclined 3 The receiving player declined the challenge.
Available on Mac OS X 10.8.2 and newer.
GKChallengeStateInvalid 0 An error occurred. The state of this challenge is not valid.
Available on Mac OS X 10.8.2 and newer.
GKChallengeStatePending 1 The challenge has been issued, but is not yet completed nor declined.
Available on Mac OS X 10.8.2 and newer.

Sub classes:

Some events for this class:

The items on this page are in the following plugins: MBS MacFrameworks Plugin.

GKAchievementViewControllerMBS   -   GKChallengesViewControllerMBS

The biggest plugin in space...

MBS Xojo Plugins