Mac Developer Library

Developer

GameKit Framework Reference GameKit Constants Reference

Options
Deployment Target:

On This Page
Language:

GameKit Constants Reference

This document describes the constants defined in the Game Kit framework that are not described in a document for an individual class.

Constants

  • The Game Kit framework error domain.

    Declaration

    Swift

    var GKErrorDomain: NSString!

    Objective-C

    NSString * const GKErrorDomain;

    Constants

    • GKErrorDomain

      GKErrorDomain

      An error occurred in Game Kit.

      Available in OS X v10.8 and later.

    Discussion

    GKSession and GKVoiceChatService define their own error domains.

  • Error codes for the Game Kit error domain.

    Declaration

    Swift

    enum GKErrorCode : Int { case Unknown case Cancelled case CommunicationsFailure case UserDenied case InvalidCredentials case NotAuthenticated case AuthenticationInProgress case InvalidPlayer case ScoreNotSet case ParentalControlsBlocked case PlayerStatusExceedsMaximumLength case PlayerStatusInvalid case MatchRequestInvalid case Underage case GameUnrecognized case NotSupported case InvalidParameter case UnexpectedConnection case ChallengeInvalid case TurnBasedMatchDataTooLarge case TurnBasedTooManySessions case TurnBasedInvalidParticipant case TurnBasedInvalidTurn case TurnBasedInvalidState case InvitationsDisabled case PlayerPhotoFailure case UbiquityContainerUnavailable }

    Objective-C

    enum { GKErrorUnknown = 1, GKErrorCancelled = 2, GKErrorCommunicationsFailure = 3, GKErrorUserDenied = 4, GKErrorInvalidCredentials = 5, GKErrorNotAuthenticated = 6, GKErrorAuthenticationInProgress = 7, GKErrorInvalidPlayer = 8, GKErrorScoreNotSet = 9, GKErrorParentalControlsBlocked = 10, GKErrorPlayerStatusExceedsMaximumLength = 11, GKErrorPlayerStatusInvalid = 12, GKErrorMatchRequestInvalid = 13, GKErrorUnderage = 14, GKErrorGameUnrecognized = 15, GKErrorNotSupported = 16, GKErrorInvalidParameter = 17, GKErrorUnexpectedConnection = 18, GKErrorChallengeInvalid = 19, GKErrorTurnBasedMatchDataTooLarge = 20, GKErrorTurnBasedTooManySessions = 21, GKErrorTurnBasedInvalidParticipant = 22, GKErrorTurnBasedInvalidTurn = 23, GKErrorTurnBasedInvalidState = 24, GKErrorInvitationsDisabled = 25, GKErrorPlayerPhotoFailure = 26, GKErrorUbiquityContainerUnavailable = 27 }; typedef NSInteger GKErrorCode;

    Constants

    • Unknown

      GKErrorUnknown

      An unexpected error occurred.

      Available in OS X v10.8 and later.

    • Cancelled

      GKErrorCancelled

      The requested operation has been cancelled or disabled by the user.

      Available in OS X v10.8 and later.

    • CommunicationsFailure

      GKErrorCommunicationsFailure

      An error occurred when communicating with Game Center.

      Available in OS X v10.8 and later.

    • UserDenied

      GKErrorUserDenied

      The operation was denied by the user.

      GKErrorUserDenied is only called when Game Center is restricted in Parental Controls or has been turned off entirely in the configuration profile. All other user cancelled actions use GKErrorCancelled.

      Available in OS X v10.8 and later.

    • InvalidCredentials

      GKErrorInvalidCredentials

      The operation failed because the player’s user name or password or both are incorrect.

      Available in OS X v10.8 and later.

    • NotAuthenticated

      GKErrorNotAuthenticated

      The local player has not been authenticated.

      Available in OS X v10.8 and later.

    • AuthenticationInProgress

      GKErrorAuthenticationInProgress

      The local player is currently authenticating.

      Available in OS X v10.8 and later.

    • InvalidPlayer

      GKErrorInvalidPlayer

      A player object or identifier is invalid.

      Available in OS X v10.8 and later.

    • ScoreNotSet

      GKErrorScoreNotSet

      A score value was not set before attempting to post the score.

      Available in OS X v10.8 and later.

    • ParentalControlsBlocked

      GKErrorParentalControlsBlocked

      The feature has been blocked by the user.

      Available in OS X v10.8 and later.

    • PlayerStatusExceedsMaximumLength

      GKErrorPlayerStatusExceedsMaximumLength

      The player’s status message is too long.

      Available in OS X v10.10 and later.

    • PlayerStatusInvalid

      GKErrorPlayerStatusInvalid

      The player’s status message is invalid.

      Available in OS X v10.10 and later.

    • MatchRequestInvalid

      GKErrorMatchRequestInvalid

      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.

      Available in OS X v10.8 and later.

    • Underage

      GKErrorUnderage

      The feature is disabled because the local player is underage.

      Available in OS X v10.8 and later.

    • GameUnrecognized

      GKErrorGameUnrecognized

      Game Center does not recognize the application that made the request. Make sure the bundle identifier is set properly for the application.

      Available in OS X v10.8 and later.

    • NotSupported

      GKErrorNotSupported

      The device does not support Game Center.

      Available in OS X v10.8 and later.

    • InvalidParameter

      GKErrorInvalidParameter

      One or more of the parameters was incorrect.

      For example, this error code may be returned if your application attempts to post a score and provides a category string that does not match a category you configured for your leaderboards on iTunes Connect.

      Available in OS X v10.8 and later.

    • UnexpectedConnection

      GKErrorUnexpectedConnection

      An unexpected player has connected to a match.

      Available in OS X v10.8 and later.

    • ChallengeInvalid

      GKErrorChallengeInvalid

      The challenge was invalid.

      Available in OS X v10.8 and later.

    • TurnBasedMatchDataTooLarge

      GKErrorTurnBasedMatchDataTooLarge

      Your game submitted data that exceeded the maximum size that Game Center permits for a turn-based game.

      Available in OS X v10.8 and later.

    • TurnBasedTooManySessions

      GKErrorTurnBasedTooManySessions

      The requested operation could not be completed because it would exceed the maximum number of sessions.

      Available in OS X v10.8 and later.

    • TurnBasedInvalidParticipant

      GKErrorTurnBasedInvalidParticipant

      One of the participant objects you provided was invalid.

      Available in OS X v10.8 and later.

    • TurnBasedInvalidTurn

      GKErrorTurnBasedInvalidTurn

      The requested operation could not be completed because the specified participant does not have the required turn state."

      Available in OS X v10.8 and later.

    • TurnBasedInvalidState

      GKErrorTurnBasedInvalidState

      The requested operation could not be completed because the session is in an invalid state.

      Available in OS X v10.8 and later.

    • GKErrorOffline

      GKErrorOffline

      The requested operation could not be completed because the device is not online.

      Available in OS X v10.8 through OS X v10.9.

    • InvitationsDisabled

      GKErrorInvitationsDisabled

      The requested operation could not be completed because the receiving player has disabled invitations.

      Available in OS X v10.10 and later.

    • PlayerPhotoFailure

      GKErrorPlayerPhotoFailure

      The requested operation to retrieve a player’s photo can not be completed.

      Available in OS X v10.10 and later.

    • UbiquityContainerUnavailable

      GKErrorUbiquityContainerUnavailable

      Para

      Available in OS X v10.10 and later.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in OS X v10.8 and later.