Contents

authenticateHandler

A handler that GameKit calls while initializing the local player.

Declaration

var authenticateHandler: ((UIViewController?, (any Error)?) -> Void)? { get set }
var authenticateHandler: ((NSViewController?, (any Error)?) -> Void)? { get set }
var authenticateHandler: (((any Error)?) -> Void)? { get set }

Parameters

  • viewController:

    A view controller that your game presents to the local player so they can perform any necessary actions to finish initialization, or nil if the initialization process is complete.

  • error:

    Describes an error if it occurs, or nil if the operation completes.

Mentioned in

Discussion

Before you can access any Game Center data and use GameKit features, you need to initialize the local player to ensure the player signs in to Game Center on the device running your game. Set this property to a method that GameKit invokes during the initialization process. If viewController is nil, Game Center initializes the player and the player can start your game. Otherwise, present the view controller so the player can perform any additional actions to complete the process.

Game Center may show a brief initialization screen if the player isn’t already signed into Game Center.

For more information about initializing Game Center with a local player, see Authenticating a player.

See Also

Authenticating the Local Player