GKScore
An object containing information for a score that was earned by the player.
Declaration
class GKScoreOverview
Your game creates GKScore objects to post scores to a leaderboard on Game Center. When your game retrieves score information from a leaderboard, those scores are returned as GKScore objects.
Scores and leaderboards work together to help you create a better game. Whenever a new GKScore object is created, it is associated with a leaderboard. You must ensure that the score being sent to a leaderboard is compatible with the leaderboard scoring format set in App Store Connect. See Leaderboards and Leaderboard Sets for information on how to create a leaderboard in App Store Connect.
To report a score to Game Center, your game allocates and initializes a new object, sets the value property to the score the player earned, and then calls the report(completionHandler:) method. The mechanism your game uses to calculate scores is up to you to design; scores are only compared within your game.
Topics
Reporting a New Score
report(_:withEligibleChallenges:withCompletionHandler:)report(_:withCompletionHandler:)report(_:withEligibleChallenges:withCompletionHandler:)
Issuing a Score Challenge
challengeComposeController(withMessage:players:completion:)GKChallengeComposeHandlerchallengeComposeController(withMessage:players:completionHandler:)challengeComposeController(withPlayers:message:completionHandler:)
Deprecated Methods and Properties
categorycontextdateformattedValueleaderboardIdentifierplayerrankvalueshouldSetDefaultLeaderboardinit(leaderboardIdentifier:)init(leaderboardIdentifier:player:)init(category:)init(leaderboardIdentifier:forPlayer:)issueChallenge(toPlayers:message:)playerIDreport(completionHandler:)
Initializers
See Also
Deprecated classes
GKAchievementViewControllerGKChallengeEventHandlerGKChallengesViewControllerGKChallengeGKScoreChallengeGKAchievementChallengeGKCloudPlayerGKGameCenterViewControllerGKGameSessionGKGameSessionSharingViewControllerGKFriendRequestComposeViewControllerGKLeaderboardViewControllerGKPeerPickerControllerGKSessionGKTurnBasedEventHandler