Platforms to show: All Mac Windows Linux Cross-Platform
GameKitMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | GameKit | MBS MacFrameworks Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Events from various objects end here, so you can implement them in a central subclass of GameKitMBS.
For most events, we carry a "tag as Variant" parameter, so you can pass a window, some object or whatever value you need.
Also we defined that matchdata is a dictionary. This way you can store various values inside including arrays (e.g. array of variant). As data is serialized over the network, you can't pass Xojo objects.
The plugin makes sure that all events run on the main thread, so please make sure you don't block main thread.
Please create only one instance of your GameKitMBS subclass.
GameKit classes are available in OS X v10.8 and later.
Please review Apple's documentation for more details and a guide.
- 82 events
- event acceptInviteCompleted(match as GKTurnBasedMatchMBS, error as NSErrorMBS, tag as Variant)
- event achievementViewControllerDidFinish(viewController as Variant)
- event addPlayersToMatchCompleted(MatchMaker as GKMatchmakerMBS, match as GKMatchMBS, matchRequest as GKMatchRequestMBS, error as NSErrorMBS, tag as Variant)
- event authenticateCompleted(localPlayer as GKLocalPlayerMBS, error as NSErrorMBS, tag as Variant)
- event authenticateHandler(LocalPlayer as GKLocalPlayerMBS, viewController as NSViewControllerMBS, error as NSErrorMBS, tag as Variant, viewControllerHandle as Integer)
- event challengesViewControllerDidFinish(viewController as Variant)
- event chooseBestHostPlayerCompleted(match as GKMatchMBS, playerID as string, tag as Variant)
- event declineInviteCompleted(match as GKTurnBasedMatchMBS, error as NSErrorMBS, tag as Variant)
- event didRequestMatchWithOtherPlayers(players() as GKPlayerMBS)
- event endMatchInTurnWithMatchDataCompleted(match as GKTurnBasedMatchMBS, matchData as Dictionary, error as NSErrorMBS, tag as Variant)
- event endTurnWithNextParticipant(match as GKTurnBasedMatchMBS, nextParticipant as GKTurnBasedParticipantMBS, matchData as Dictionary, error as NSErrorMBS, tag as Variant)
- event endTurnWithNextParticipantsCompleted(match as GKTurnBasedMatchMBS, nextParticipants() as GKTurnBasedParticipantMBS, timeout as Double, matchData as Dictionary, error as NSErrorMBS, tag as Variant)
- event findMatchForRequestCompleted(MatchMaker as GKMatchmakerMBS, request as GKMatchRequestMBS, match as GKMatchMBS, TurnBasedMatch as GKTurnBasedMatchMBS, error as NSErrorMBS, tag as Variant)
- event findPlayersForHostedMatchRequestCompleted(MatchMaker as GKMatchmakerMBS, request as GKMatchRequestMBS, playerIDs() as string, error as NSErrorMBS, tag as Variant)
- event friendRequestComposeViewControllerDidFinish(viewController as Variant)
- event gameCenterViewControllerDidFinish(gameCenterViewController as Variant)
- event handleInviteFromGameCenter(playersToInvite() as string)
- event handleMatchEnded(match as GKTurnBasedMatchMBS)
- event handleTurnEventForMatch(match as GKTurnBasedMatchMBS, didBecomeActive as boolean)
- event Invited(MatchMaker as GKMatchmakerMBS, acceptedInvite as GKInviteMBS, playersToInvite() as string)
- event inviteeResponseHandler(MatchRequest as GKMatchRequestMBS, PlayerID as string, response as Integer, tag as Variant)
- event leaderboardViewControllerDidFinish(viewController as Variant)
- event loadAchievementDescriptionsCompleted(achievements() as GKAchievementDescriptionMBS, error as NSErrorMBS, tag as Variant)
- event loadAchievementsCompleted(achievements() as GKAchievementMBS, error as NSErrorMBS, tag as Variant)
- event loadCategoriesCompleted(categories() as string, titles() as string, error as NSErrorMBS, tag as Variant)
- event loadDefaultLeaderboardCategoryIDCompleted(LocalPlayer as GKLocalPlayerMBS, categoryID as string, error as NSErrorMBS, tag as Variant)
- event loadFriendPlayersCompleted(localPlayer as GKLocalPlayerMBS, friendPlayers() as GKPlayerMBS, error as NSErrorMBS, tag as Variant)
- event loadFriendsCompleted(localPlayer as GKLocalPlayerMBS, friends() as string, error as NSErrorMBS, tag as Variant)
- event loadImageCompleted(description as GKAchievementDescriptionMBS, image as NSImageMBS, error as NSErrorMBS, tag as Variant)
- event loadLeaderboardsCompleted(Leaderboards() as GKLeaderboardMBS, error as NSErrorMBS, tag as Variant)
- event loadMatchDataCompleted(match as GKTurnBasedMatchMBS, matchData as Dictionary, error as NSErrorMBS, tag as Variant)
- event loadMatchesCompleted(matches() as GKTurnBasedMatchMBS, error as NSErrorMBS, tag as Variant)
- event loadMatchWithIDCompleted(TurnBasedMatch as GKTurnBasedMatchMBS, matchID as string, error as NSErrorMBS, tag as Variant)
- event loadPhotoForSizeCompleted(player as GKPlayerMBS, size as Integer, photo as NSImageMBS, error as NSErrorMBS, tag as Variant)
- event loadPlayersForIdentifiersCompleted(identifiers() as string, players() as GKPlayerMBS, error as NSErrorMBS, tag as Variant)
- event loadReceivedChallengesCompleted(challenges() as GKChallengeMBS, error as NSErrorMBS, tag as Variant)
- event loadScoresCompleted(Leaderboard as GKLeaderboardMBS, scores() as GKScoreMBS, error as NSErrorMBS, tag as Variant)
- event localPlayerDidCompleteChallenge(challenge as GKChallengeMBS)
- event localPlayerDidReceiveChallenge(challenge as GKChallengeMBS)
- event localPlayerDidSelectChallenge(challenge as GKChallengeMBS)
- event matchConnectionWithPlayerFailed(match as GKMatchMBS, playerID as string, error as NSErrorMBS)
- event matchDidChangeState(match as GKMatchMBS, playerID as string, state as Integer)
- event matchDidFailWithError(match as GKMatchMBS, error as NSErrorMBS)
- event matchDidReceiveData(match as GKMatchMBS, data as Dictionary, playerID as string)
- event matchEnded(player as GKPlayerMBS, match as GKTurnBasedMatchMBS)
- event matchForInviteCompleted(Matchmaker as GKMatchmakerMBS, invite as GKInviteMBS, match as GKMatchMBS, error as NSErrorMBS, tag as Variant)
- event matchmakerViewControllerDidFailWithError(viewController as Variant, error as NSErrorMBS)
- event matchmakerViewControllerDidFindMatch(viewController as Variant, match as GKMatchMBS)
- event matchmakerViewControllerDidFindPlayers(viewController as Variant, playerIDs() as string)
- event matchmakerViewControllerDidReceiveAcceptFromHostedPlayer(viewController as Variant, playerID as string)
- event matchmakerViewControllerWasCancelled(viewController as Variant)
- event matchShouldReinvitePlayer(match as GKMatchMBS, playerID as string) as boolean
- event NotificationBannerCompleted(title as string, message as string, duration as Double, tag as Variant)
- event participantQuitInTurnWithOutcomeCompleted(match as GKTurnBasedMatchMBS, matchOutcome as Integer, nextParticipant as GKTurnBasedParticipantMBS, nextParticipants() as GKTurnBasedParticipantMBS, timeout as Double, matchData as Dictionary, error as NSErrorMBS, tag as Variant)
- event participantQuitOutOfTurnWithOutcomeCompleted(match as GKTurnBasedMatchMBS, matchOutcome as Integer, error as NSErrorMBS, tag as Variant)
- event PlayerAuthenticationDidChange(player as GKPlayerMBS)
- event playerChanged(player as GKPlayerMBS)
- event playerStateUpdate(playerID as string, state as Integer, tag as Variant)
- event queryActivityCompleted(MatchMaker as GKMatchmakerMBS, activity as Integer, error as NSErrorMBS, tag as Variant)
- event queryPlayerGroupActivityCompleted(MatchMaker as GKMatchmakerMBS, playerGroup as Integer, activity as Integer, error as NSErrorMBS, tag as Variant)
- event receivedTurnEventForMatch(player as GKPlayerMBS, match as GKTurnBasedMatchMBS, didBecomeActive as boolean)
- event recipientResponseHandler(MatchRequest as GKMatchRequestMBS, Player as GKPlayerMBS, response as Integer, tag as Variant)
- event rematchCompleted(TurnMatch as GKTurnBasedMatchMBS, match as GKMatchMBS, error as NSErrorMBS, tag as Variant)
- event remotePlayerDidCompleteChallenge(challenge as GKChallengeMBS)
- event removeCompleted(match as GKTurnBasedMatchMBS, error as NSErrorMBS, tag as Variant)
- event reportAchievementCompleted(score as GKAchievementMBS, error as NSErrorMBS, tag as Variant)
- event reportAchievementsCompleted(achievements() as GKAchievementMBS, error as NSErrorMBS, tag as Variant)
- event reportScoreCompleted(score as GKScoreMBS, error as NSErrorMBS, tag as Variant)
- event reportScoresCompleted(Scores() as GKScoreMBS, error as NSErrorMBS, tag as Variant)
- event resetAchievementsCompleted(error as NSErrorMBS, tag as Variant)
- event saveCurrentTurnWithMatchDataCompleted(match as GKTurnBasedMatchMBS, matchData as Dictionary, error as NSErrorMBS, tag as Variant)
- event selectChallengeablePlayerIDsCompleted(Achievement as GKAchievementMBS, playerIDs() as string, challengeablePlayerIDs() as string, error as NSErrorMBS, tag as Variant)
- event setDefaultLeaderboardCategoryIDCompleted(LocalPlayer as GKLocalPlayerMBS, categoryID as string, error as NSErrorMBS, tag as Variant)
- event setDefaultLeaderboardCompleted(categoryID as string, error as NSErrorMBS, tag as Variant)
- event shouldShowBannerForLocallyCompletedChallenge(challenge as GKChallengeMBS) as boolean
- event shouldShowBannerForLocallyReceivedChallenge(challenge as GKChallengeMBS) as boolean
- event shouldShowBannerForRemotelyCompletedChallenge(challenge as GKChallengeMBS) as boolean
- event startBrowsingForNearbyPlayersCompleted(Matchmaker as GKMatchmakerMBS, playerID as string, reachable as boolean, tag as Variant)
- event turnBasedMatchmakerViewControllerDidFailWithError(viewController as Variant, error as NSErrorMBS)
- event turnBasedMatchmakerViewControllerDidFindMatch(viewController as Variant, match as GKTurnBasedMatchMBS)
- event turnBasedMatchmakerViewControllerPlayerQuitForMatch(viewController as Variant, match as GKTurnBasedMatchMBS)
- event turnBasedMatchmakerViewControllerWasCancelled(viewController as Variant)
- 4 shared methods
- shared method Available as boolean
- shared method GKErrorDomain as string
- shared method showBannerWithTitle(title as string, message as string, duration as Double, tag as Variant)
- shared method showBannerWithTitle(title as string, message as string, tag as Variant)
- 35 constants
GameKit Error Constants
Constant | Value | Description |
---|---|---|
GKErrorAuthenticationInProgress | 7 |
The local player is currently authenticating. |
GKErrorCancelled | 2 |
The requested operation was canceled. |
GKErrorChallengeInvalid | 19 |
The challenge was invalid. Available on Mac OS X 10.8.2 and newer. |
GKErrorCommunicationsFailure | 3 |
An error occurred when communicating with Game Center. |
GKErrorGameUnrecognized | 15 |
nGame Center does not recognize the application that made the request. Make sure the bundle identifier is set properly for the application.one |
GKErrorInvalidCredentials | 5 |
The operation failed because the player's user name or password or both are incorrect. |
GKErrorInvalidParameter | 17 | One or more of the parameters was incorrect. more |
GKErrorInvalidPlayer | 8 |
A player object or identifier is invalid. |
GKErrorMatchRequestInvalid | 13 |
The match request's properties are impossible to fulfill. For example, the minimum number of players cannot be larger than the maximum number of players. |
GKErrorNotAuthenticated | 6 |
The local player has not been authenticated. |
GKErrorNotSupported | 16 |
The device does not support Game Center. |
GKErrorOffline | 25 |
The user went offline. In Mac OS X 10.8.2 and newer this constant has value 25. In older versions it has value 19. |
GKErrorParentalControlsBlocked | 10 |
The feature has been blocked by the user. |
GKErrorScoreNotSet | 9 |
A score value was not set before attempting to post the score. |
GKErrorTurnBasedInvalidParticipant | 22 |
One of the participant objects you provided was invalid. Available on Mac OS X 10.8.2 and newer. |
GKErrorTurnBasedInvalidState | 24 |
The requested operation could not be completed because the session is in an invalid state. Available on Mac OS X 10.8.2 and newer. |
GKErrorTurnBasedInvalidTurn | 23 |
The requested operation could not be completed because the specified participant does not have the required turn state. Available on Mac OS X 10.8.2 and newer. |
GKErrorTurnBasedMatchDataTooLarge | 20 |
Your game submitted data that exceeded the maximum size that Game Center permits for a turn-based game. Available on Mac OS X 10.8.2 and newer. |
GKErrorTurnBasedTooManySessions | 21 |
The requested operation could not be completed because it would exceed the maximum number of sessions. Available on Mac OS X 10.8.2 and newer. |
GKErrorUnderage | 14 |
The feature is disabled because the local player is underage. |
GKErrorUnexpectedConnection | 18 |
An unexpected player has connected to a match. |
GKErrorUnknown | 1 |
An unexpected error occurred. |
GKErrorUserDenied | 4 |
The operation was denied by the user. |
Response Constants
Constant | Value | Description |
---|---|---|
GKInviteeResponseAccepted | 0 |
The player accepted the invitation. Available on Mac OS X 10.8.2 and newer. |
GKInviteeResponseDeclined | 1 |
The player rejected the invitation. Available on Mac OS X 10.8.2 and newer. |
GKInviteeResponseFailed | 2 |
The invitation was unable to be delivered. Available on Mac OS X 10.8.2 and newer. |
GKInviteeResponseIncompatible | 3 |
The invitee is not running a compatible version of your game. Available on Mac OS X 10.8.2 and newer. |
GKInviteeResponseNoAnswer | 5 |
The invitation timed out without an answer. Available on Mac OS X 10.8.2 and newer. |
GKInviteeResponseUnableToConnect | 4 |
The invitee could not be contacted. Available on Mac OS X 10.8.2 and newer. |
Invite Responses
Constant | Value | Description |
---|---|---|
GKInviteRecipientResponseAccepted | 0 |
The player accepted the invitation. Available in OS X v10.10 and later. |
GKInviteRecipientResponseDeclined | 1 |
The player rejected the invitation. Available in OS X v10.10 and later. |
GKInviteRecipientResponseFailed | 2 |
The invitation was unable to be delivered. Available in OS X v10.10 and later. |
GKInviteRecipientResponseIncompatible | 3 |
The invitee is not running a compatible version of your game. Available in OS X v10.10 and later. |
GKInviteRecipientResponseNoAnswer | 5 |
The invitation timed out without an answer. Available in OS X v10.10 and later. |
GKInviteRecipientResponseUnableToConnect | 4 |
The invitee could not be contacted. Available in OS X v10.10 and later. |
This class has no sub classes.
Some examples using this class:
Blog Entries
Xojo Developer Magazine
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
GADRewardedInterstitialAdMBS - GammaFadeMBS