GKError

Inherits: RefCounted < Object

Represents an error returned by Game Center operations.

Description

This class wraps GKError information, providing the error code, domain, and localized message.

The code property corresponds to the Code constants.

Properties

int

code

0

String

domain

""

String

message

""


Enumerations

enum Code: 🔗

Code GAME_UNRECOGNIZED = 0

The system can’t complete the requested operation because Game Center doesn’t recognize the app.

Code NOT_SUPPORTED = 1

Game Center isn’t available for this app, device, or account.

Code APP_UNLISTED = 2

The system can’t complete the requested operation because the game isn’t available on the App Store.

Code UNKNOWN = 3

The system can’t complete the requested operation due to an unknown error.

Code CANCELLED = 4

The operation was canceled by the user or by the system.

Code COMMUNICATIONS_FAILURE = 5

The system can’t complete the requested operation due to an error communicating with the server.

Code INVALID_PLAYER = 6

The system can’t complete the requested operation because the player is invalid.

Code INVALID_PARAMETER = 7

The system can’t complete the requested operation because one or more parameters are invalid.

Code GAME_SESSION_REQUEST_INVALID = 8

The properties of the game session request are impossible to fulfill.

Code API_NOT_AVAILABLE = 9

The system can’t complete the requested operation because the API isn’t available.

Code CONNECTION_TIMEOUT = 10

The system can’t complete the requested operation because the connection timed out.

Code API_OBSOLETE = 11

The operation uses an obsolete Game Center API.

Code USER_DENIED = 12

The system can’t complete the requested operation because the user denied it.

Code INVALID_CREDENTIALS = 13

The system can’t complete the requested operation because the user name or password are incorrect.

Code NOT_AUTHENTICATED = 14

The local player is not authenticated with Game Center.

Code AUTHENTICATION_IN_PROGRESS = 15

The system can’t complete the requested operation because the local player is already authenticating.

Code PARENTAL_CONTROLS_BLOCKED = 16

The system can’t complete the requested operation because the user disabled this feature in Restrictions.

Code PLAYER_STATUS_EXCEEDS_MAXIMUM_LENGTH = 17

The player’s status exceeds the maximum length.

Code PLAYER_STATUS_INVALID = 18

The player’s status is invalid.

Code UNDERAGE = 19

The system can’t complete the requested operation because this feature isn’t available to underage players.

Code PLAYER_PHOTO_FAILURE = 20

The system can’t complete the requested operation to retrieve a player’s photo.

Code UBIQUITY_CONTAINER_UNAVAILABLE = 21

The system can’t complete the requested operation because the user hasn’t signed in to iCloud or hasn’t enabled iCloud Drive.

Code NOT_AUTHORIZED = 22

The app or player is not authorized to perform this operation.

Code ICLOUD_UNAVAILABLE = 23

The system can’t complete the requested operation because it can’t access the player’s iCloud account.

Code LOCKDOWN_MODE = 24

The system can’t complete the requested operation because the player enabled Lockdown Mode on the device.

Code FRIEND_LIST_DESCRIPTION_MISSING = 25

Access to the friends list was denied because a required usage description is missing.

Code FRIEND_LIST_RESTRICTED = 26

Access to the local player’s friends list is restricted by system policy.

Code FRIEND_LIST_DENIED = 27

Access to the local player’s friends list was denied by the user.

Code FRIEND_REQUEST_NOT_AVAILABLE = 28

The player can’t send a friend request at this time from this device.

Code MATCH_REQUEST_INVALID = 29

The system can’t complete the requested operation because the match request is invalid.

Code UNEXPECTED_CONNECTION = 30

An unexpected player has connected to a match.

Code INVITATIONS_DISABLED = 31

The system can’t complete the requested operation because the receiving player has disabled invitations.

Code MATCH_NOT_CONNECTED = 32

The system can’t complete the requested operation because the match isn’t connected to other players.

Code RESTRICTED_TO_AUTOMATCH = 33

The system can’t complete the requested operation because the player is using automatch.

Code TURN_BASED_MATCH_DATA_TOO_LARGE = 34

The system can’t complete the requested operation because the match data is too large.

Code TURN_BASED_TOO_MANY_SESSIONS = 35

The system can’t complete the requested operation because it exceeds the maximum number of sessions.

Code TURN_BASED_INVALID_PARTICIPANT = 36

The system can’t complete the requested operation because the specified participant is invalid.

Code TURN_BASED_INVALID_TURN = 37

The system can’t complete the requested operation because the participant doesn’t have the required turn state.

Code TURN_BASED_INVALID_STATE = 38

The system can’t complete the requested operation because the session is in an invalid state.

Code SCORE_NOT_SET = 39

The system can’t complete the requested operation because the system hasn’t set the score.

Code CHALLENGE_INVALID = 40

The challenge request failed due to invalid challenge data. (Deprecated)

Code DEBUG_MODE = 41

The operation failed because Game Center is running in debug mode.


Property Descriptions

int code = 0 🔗

  • void set_code(value: int)

  • int get_code()

The mapped Game Center error code. See Code for possible values.


String domain = "" 🔗

  • void set_domain(value: String)

  • String get_domain()

The NSError domain for the failure, typically GKErrorDomain.


String message = "" 🔗

  • void set_message(value: String)

  • String get_message()

A localized, user-readable description of the failure.