Platforms to show: All Mac Windows Linux Cross-Platform
GKChallengeMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | GameKit | MBS MacFrameworks Plugin | 13.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
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.
- property Handle as Integer
- 8 methods
- method completionDate as date
- method Constructor Private
- method decline
- method issueDate as date
- method issuingPlayerID as string
- method message as string
- method receivingPlayerID as string
- method state as Integer
- 2 shared methods
- shared method Available as boolean
- shared method loadReceivedChallenges(tag as Variant = nil)
- 4 constants
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 using this class:
- GameKitMBS.loadReceivedChallengesCompleted(challenges() as GKChallengeMBS, error as NSErrorMBS, tag as Variant)
- GameKitMBS.localPlayerDidCompleteChallenge(challenge as GKChallengeMBS)
- GameKitMBS.localPlayerDidReceiveChallenge(challenge as GKChallengeMBS)
- GameKitMBS.localPlayerDidSelectChallenge(challenge as GKChallengeMBS)
- GameKitMBS.remotePlayerDidCompleteChallenge(challenge as GKChallengeMBS)
- GameKitMBS.shouldShowBannerForLocallyCompletedChallenge(challenge as GKChallengeMBS) as boolean
- GameKitMBS.shouldShowBannerForLocallyReceivedChallenge(challenge as GKChallengeMBS) as boolean
- GameKitMBS.shouldShowBannerForRemotelyCompletedChallenge(challenge as GKChallengeMBS) as boolean
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
GKAchievementViewControllerMBS - GKChallengesViewControllerMBS