GPGScore Class Reference

GPGScore Class Reference

Overview

A single score for a specific leaderboard.

This object is the means by which scores are reported to leaderboards and retrieved via GPGLeaderboard's actions.

Properties

Constant Properties
NSString * leaderboardId
 The leaderboard identifier for this score object.
Configurable Properties
int64_t value
 The score value to report or that was retrieved from the leaderboard.
NSString * scoreTag
 Additional information about the score.
Post-Load Results
NSURL * avatarUrl
 A url to the avatar for the player associated with this score.
NSString * displayName
 The player's display name.
NSString * formattedRank
 The presentable string form of the rank.
NSString * formattedScore
 The presentable string form of the score.
NSString * playerId
 The player identifier that this score belongs to.
GPGPlayerplayer
 The player that this score belongs to.
int64_t rank
 The rank of this score relative to all other scores in the leaderboard.
NSString * timeSpan
 The time span the score applies to.
int64_t writeTimestamp
 The timestamp of when this score was submitted.

Initialization

(instancetype) - initWithLeaderboardId:
 Initializes a newly allocated score object with a given leaderboard identifier.
(instancetype) + scoreWithLeaderboardId:
 Convenience method for initWithLeaderboardId:.

Actions

(BOOL) - submitScoreWithCompletionHandler:
 Reports the score's current value to the score's leaderboard and executes the given completion handler once finished.
(void) + batchSubmitScores:withCompletionHandler:
 Deprecated.
(void) + batchSubmitScores:completionHandler:
 Reports a list of GPGScore instances in a batch and executes the given completion handler once per score when finished.

Member Function Documentation

- (instancetype) initWithLeaderboardId: (NSString *)  leaderboardId

Initializes a newly allocated score object with a given leaderboard identifier.

+ (instancetype) scoreWithLeaderboardId: (NSString *)  leaderboardId

Convenience method for initWithLeaderboardId:.

Returns:
A newly allocated and initialized GPGScore object.
- (BOOL) submitScoreWithCompletionHandler: (GPGScoreReportScoreBlock)  completionHandler

Reports the score's current value to the score's leaderboard and executes the given completion handler once finished.

Parameters:
completionHandler(optional) A block of the form: ^(GPGScoreReport *report, NSError *error).
Returns:
Whether the operation was queued for submission
+ (void) batchSubmitScores: (NSArray *)  scores
withCompletionHandler: (GPGScoreReportScoreBlock)  completionHandler 

Deprecated.

Use [GPGScore batchSubmitScores:completionHandler:]. Reports a list of GPGScore instances in a batch and executes the given completion handler once per score when finished. GPGScore instances should have unique leaderboard IDs. Any duplicate leaderboard IDs will be collapsed into a single "best" score for that ID. The "best" score is determined by the value of order of the GPGLeaderboardMetadata for the given leaderboard. If the device is offline, the completion handler is called immediately for each score and the score is stored in the local cache. The score is submitted automatically when the device is back online.

Parameters:
scoresAn array of GPGScore instances.
completionHandler(optional) A block of the form: ^(GPGScoreReport *report, NSError *error).
+ (void) batchSubmitScores: (NSArray *)  scores
completionHandler: (GPGScoreReportScoreBlock)  completionHandler 

Reports a list of GPGScore instances in a batch and executes the given completion handler once per score when finished.

GPGScore instances should have unique leaderboard IDs. Any duplicate leaderboard IDs will be collapsed into a single "best" score for that ID. The "best" score is determined by the value of order of the GPGLeaderboardMetadata for the given leaderboard. If the device is offline, the completion handler is called immediately for each score and the score is stored in the local cache. The score is submitted automatically when the device is back online.

Parameters:
scoresAn array of GPGScore instances.
completionHandler(optional) A block of the form: ^(GPGScoreReport *report, NSError *error).

Property Documentation

- (NSString*) leaderboardId [read, copy]

The leaderboard identifier for this score object.

- (int64_t) value [read, write, assign]

The score value to report or that was retrieved from the leaderboard.

- (NSString*) scoreTag [read, write, copy]

Additional information about the score.

Values must contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.

- (NSURL *) avatarUrl [read, copy]

A url to the avatar for the player associated with this score.

Valid only when the score has been retrieved from a leaderboard.

- (NSString *) displayName [read, copy]

The player's display name.

Valid only when the score has been retrieved from a leaderboard.

- (NSString*) formattedRank [read, copy]

The presentable string form of the rank.

Valid only when the score has been retrieved from a leaderboard.

- (NSString*) formattedScore [read, copy]

The presentable string form of the score.

Valid only when the score has been retrieved from a leaderboard.

- (NSString *) playerId [read, copy]

The player identifier that this score belongs to.

Valid only when the score has been retrieved from a leaderboard.

- (GPGPlayer*) player [read, assign]

The player that this score belongs to.

Valid only when the score has been retrieved from a leaderboard.

- (int64_t) rank [read, assign]

The rank of this score relative to all other scores in the leaderboard.

Valid only when the score has been retrieved from a leaderboard.

- (NSString*) timeSpan [read, copy]

The time span the score applies to.

- (int64_t) writeTimestamp [read, assign]

The timestamp of when this score was submitted.

Send feedback about...

Play Games Services for iOS
Play Games Services for iOS