Contents

GKLocalPlayer

The local player who signs in to Game Center on the device running the game.

Declaration

class GKLocalPlayer

Mentioned in

Overview

Only one player can sign in to Game Center on a device at a time and that player is the local player. Before you can start a game that uses GameKit features, verify that the local player signs in to their Game Center account.

You set the handler of the local player shared instance using the authenticateHandler property. Then implement this method to handle the multiple times GameKit invokes it during the sign-in process. If the local player needs to create an account or sign in, GameKit provides a view controller that you present to the local player. If the local player successfully signs in, determine whether they have any account restrictions and adjust your game accordingly. For more information about the initialization of the local player, see Authenticating a player.

After the local player signs in, their account data and GameKit features are available. You can display the local player’s nickname and avatar, access their recent players and friends, and load their leaderboards and achievements. You can also register a listener object that GameKit calls when the local player sends or accepts invitations to play with others.

Topics

Accessing the Local Player

Authenticating the Local Player

Determining Whether the Player Is Underage or Restricted

Accessing Friends and Recents

Adding Friends

Working with Leaderboards

Registering Listeners

Saving Game Data

Deprecated

See Also

Players