iOS 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 iOS 4.0 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 iOS 4.0 and later.

    • Cancelled

      GKErrorCancelled

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

      Available in iOS 4.0 and later.

    • CommunicationsFailure

      GKErrorCommunicationsFailure

      An error occurred when communicating with Game Center.

      Available in iOS 4.0 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 iOS 4.0 and later.

    • InvalidCredentials

      GKErrorInvalidCredentials

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

      Available in iOS 4.0 and later.

    • NotAuthenticated

      GKErrorNotAuthenticated

      The local player has not been authenticated.

      Available in iOS 4.0 and later.

    • AuthenticationInProgress

      GKErrorAuthenticationInProgress

      The local player is currently authenticating.

      Available in iOS 4.0 and later.

    • InvalidPlayer

      GKErrorInvalidPlayer

      A player object or identifier is invalid.

      Available in iOS 4.0 and later.

    • ScoreNotSet

      GKErrorScoreNotSet

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

      Available in iOS 4.0 and later.

    • ParentalControlsBlocked

      GKErrorParentalControlsBlocked

      The feature has been blocked by the user.

      Available in iOS 4.0 and later.

    • PlayerStatusExceedsMaximumLength

      GKErrorPlayerStatusExceedsMaximumLength

      The player’s status message is too long.

      Available in iOS 4.0 and later.

    • PlayerStatusInvalid

      GKErrorPlayerStatusInvalid

      The player’s status message is invalid.

      Available in iOS 4.0 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 iOS 4.0 and later.

    • Underage

      GKErrorUnderage

      The feature is disabled because the local player is underage.

      Available in iOS 4.1 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 iOS 4.1 and later.

    • NotSupported

      GKErrorNotSupported

      The device does not support Game Center.

      Available in iOS 4.1 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 iOS 4.2 and later.

    • UnexpectedConnection

      GKErrorUnexpectedConnection

      An unexpected player has connected to a match.

      Available in iOS 5.0 and later.

    • ChallengeInvalid

      GKErrorChallengeInvalid

      The challenge was invalid.

      Available in iOS 6.0 and later.

    • TurnBasedMatchDataTooLarge

      GKErrorTurnBasedMatchDataTooLarge

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

      Available in iOS 6.0 and later.

    • TurnBasedTooManySessions

      GKErrorTurnBasedTooManySessions

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

      Available in iOS 6.0 and later.

    • TurnBasedInvalidParticipant

      GKErrorTurnBasedInvalidParticipant

      One of the participant objects you provided was invalid.

      Available in iOS 6.0 and later.

    • TurnBasedInvalidTurn

      GKErrorTurnBasedInvalidTurn

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

      Available in iOS 6.0 and later.

    • TurnBasedInvalidState

      GKErrorTurnBasedInvalidState

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

      Available in iOS 6.0 and later.

    • InvitationsDisabled

      GKErrorInvitationsDisabled

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

      Available in iOS 7.0 and later.

    • PlayerPhotoFailure

      GKErrorPlayerPhotoFailure

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

      Available in iOS 8.0 and later.

    • UbiquityContainerUnavailable

      GKErrorUbiquityContainerUnavailable

      Para

      Available in iOS 8.0 and later.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in iOS 4.0 and later.