Instance Method

report(completionHandler:)

Reports a score to Game Center.

Declaration

func report(completionHandler: ((Error?) -> Void)? = nil)

Parameters

completionHandler

A block to be called after the score is reported.

The block receives the following parameter:

error

If an error occurred, this parameter holds an error object that describes the problem. If the score was successfully reported, this parameter’s value is nil.

Discussion

The value property must be set before calling this method.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, GameKit calls your completion handler. The completion handler is always called on the main thread.

See Also

Deprecated Methods and Properties

var category: String?

The leaderboard that this score belongs to.

Deprecated
func challengeComposeController(withPlayers: [String]?, message: String?, completionHandler: GKChallengeComposeCompletionBlock?) -> UIViewController?

Provides a challenge compose view controller with pre-selected player identifiers and a preformatted, player-editable message.

Deprecated
init(category: String?)

Returns an initialized score object.

Deprecated
init(leaderboardIdentifier: String, forPlayer: String)

Returns an initialized score object for the specified leaderboard and player.

Deprecated
func issueChallenge(toPlayers: [String]?, message: String?)

Issues a score challenge to a set of players.

Deprecated
var playerID: String

The player identifier for the player that earned the score.

Deprecated