<!--
{
  "availability" : [
    "iOS: 4.1.0 -",
    "iPadOS: 4.1.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKPlayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKPlayer"
  },
  "title" : "GKPlayer"
}
-->

# GKPlayer

A remote player who the local player running your game can invite and communicate with through Game Center.

```
class GKPlayer
```

## Overview

Before using Game Center for the first time, players create a single account that identifies them across all Game Center games. The player only needs to sign in to Game Center once per device to start using GameKit features in your game. A player sets a nickname and avatar in their account that provide a consistent and familiar look in your game. Game Center then uses the account to record leaderboard scores and achievements, and to start games with other players.

In your code, [`GKPlayer`](/documentation/GameKit/GKPlayer) represents remote or other players who the local player running your app can invite and communicate with. [`GKPlayer`](/documentation/GameKit/GKPlayer) is also the superclass for the local player [`GKLocalPlayer`](/documentation/GameKit/GKLocalPlayer) class that provides common data and methods for all players. For example, use the [`alias`](/documentation/GameKit/GKPlayer/alias) property to get the nickname for a player. To load the player avatars, use the [`loadPhoto(for:withCompletionHandler:)`](/documentation/GameKit/GKPlayer/loadPhoto(for:withCompletionHandler:)) method.

To create a guest player who doesn’t have a Game Center account, use the [`anonymousGuestPlayer(withIdentifier:)`](/documentation/GameKit/GKPlayer/anonymousGuestPlayer(withIdentifier:)) method. GameKit treats guest players similar to Game Center players except they can’t earn achievements, post to leaderboards, or participate in challenges.

Use the [`gamePlayerID`](/documentation/GameKit/GKPlayer/gamePlayerID) property as a unique identifier for just your game, and the [`teamPlayerID`](/documentation/GameKit/GKPlayer/teamPlayerID) property as a unique identifier for all games that you offer through your developer account. For more information, see [Protecting the player’s privacy using scoped identifiers](/documentation/GameKit/protecting-the-player-s-privacy-using-scoped-identifiers).

## Topics

### Identifying the player

[`gamePlayerID`](/documentation/GameKit/GKPlayer/gamePlayerID)

A unique identifier for a player of the game.

[`teamPlayerID`](/documentation/GameKit/GKPlayer/teamPlayerID)

A unique identifier for a player of all the games that you distribute using your developer account.

[`-  scopedIDsArePersistent`](/documentation/GameKit/GKPlayer/scopedIDsArePersistent())

Returns a Boolean value depending on whether the player identifiers are persistent across game instances or unique to the game instance.

[`GKPlayerIDNoLongerAvailable`](/documentation/GameKit/GKPlayerIDNoLongerAvailable)

A constant for a player ID that’s no longer available.

[`playerID`](/documentation/GameKit/GKPlayer/playerID)

A unique identifier for a player of the game.

### Accessing player details

[`alias`](/documentation/GameKit/GKPlayer/alias)

A string the player chooses to identify themself to other players.

[`displayName`](/documentation/GameKit/GKPlayer/displayName)

A string to display for the player.

[`isInvitable`](/documentation/GameKit/GKPlayer/isInvitable)

A Boolean value that indicates whether the local player can send an invitation to the player.

[`isFriend`](/documentation/GameKit/GKPlayer/isFriend)

A Boolean value that indicates whether the player is a friend of the local player.

### Loading player photos

[`-  loadPhotoForSize:withCompletionHandler:`](/documentation/GameKit/GKPlayer/loadPhoto(for:withCompletionHandler:))

Loads a photo of the player from Game Center.

[`PhotoSize`](/documentation/GameKit/GKPlayer/PhotoSize)

The size of a photo that Game Center loads.

### Creating a guest player

[`+  anonymousGuestPlayerWithIdentifier:`](/documentation/GameKit/GKPlayer/anonymousGuestPlayer(withIdentifier:))

Creates a guest player with the specified identifier.

[`guestIdentifier`](/documentation/GameKit/GKPlayer/guestIdentifier)

A developer-created string that identifies a guest player.

### Observing notifications

  <doc://com.apple.documentation/documentation/Foundation/NSNotification/Name-swift.struct/GKPlayerDidChangeNotificationName>

[`GKPlayerDidChangeNotificationName`](/documentation/GameKit/GKPlayerDidChangeNotificationName)

A notification that posts when a player object’s data changes.

### Loading player details

[`+  loadPlayersForIdentifiers:withCompletionHandler:`](/documentation/GameKit/GKPlayer/loadPlayers(forIdentifiers:withCompletionHandler:))

Loads information about a list of players from Game Center.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCopying`](/documentation/Foundation/NSCopying)

### Inherited By

[`GKLocalPlayer`](/documentation/GameKit/GKLocalPlayer)

### Inherits From

[`GKBasePlayer`](/documentation/GameKit/GKBasePlayer)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)