GPGAppStateModel Class Reference

GPGAppStateModel Class Reference

Overview

Deprecated.

Game developers are highly encouraged to migrate from the Cloud Save (App State) service to the Saved Games (Snapshot) service as soon as possible. An object that holds AppState information for a particular key.

AppState is a blob of data you store in the cloud. While this can be any data you wish as an NSData object, we suggest that you use this for your AppState to support moving from one device to another (for example, if the user leaves one device and then resumes on another device).

Here's an example of how to access this model:

 GPGAppStateModel *model = [GPGManager sharedInstance].applicationModel.appstate;

Public Member Functions

(void) - setStateData:forKey:
 Sets the AppState data for a given key.
(NSData *) - stateDataForKey:
 Gets the AppState data for a given key.
(void) - listStatesWithCompletionHandler:conflictHandler:
 Lists all AppState data from the cloud.
(void) - listStateKeysWithCompletionHandler:
 Lists current set of AppState keys from the cloud.
(void) - loadForKey:completionHandler:conflictHandler:
 Downloads the latest version of the AppState data from the cloud.
(void) - updateForKey:completionHandler:conflictHandler:
 Writes the local AppState to the cloud.
(void) - clearForKey:completionHandler:conflictHandler:
 Initiates a request to clear the AppState data for the given key.
(void) - deleteForKey:completionHandler:
 Initiates a request to delete the AppState data.

Member Function Documentation

- (void) setStateData: (NSData *)  state
forKey: (NSNumber *)  key 

Sets the AppState data for a given key.

Parameters:
stateThe AppState data that is being saved.
keyThe key for the AppState data.
- (NSData *) stateDataForKey: (NSNumber *)  key

Gets the AppState data for a given key.

Parameters:
keyThe key for the AppState data.
- (void) listStatesWithCompletionHandler: (GPGAppStateListHandler)  completionHandler
conflictHandler: (GPGAppStateConflictHandler)  conflictHandler 

Lists all AppState data from the cloud.

The handlers will be called once per key.

Parameters:
completionHandlerThe block to call when the AppState is finished downloading. It's of the form: ^(NSNumber *key, NSData *state, NSError *error).
conflictHandlerThe block to call in order to handle local modifications to the data. It's of the form: ^(NSNumber *key, NSData *localState, NSData *remoteState) Return your resolved data from this callback to apply it.
- (void) listStateKeysWithCompletionHandler: (GPGAppStateListKeysHandler)  completionHandler

Lists current set of AppState keys from the cloud.

Parameters:
completionHandlerA block of the form: ^(NSArray *states, NSNumber *maxKeyCount, NSError *error)
- (void) loadForKey: (NSNumber *)  key
completionHandler: (GPGAppStateLoadResultHandler)  completionHandler
conflictHandler: (GPGAppStateConflictHandler)  conflictHandler 

Downloads the latest version of the AppState data from the cloud.

Parameters:
keyThe key for the AppState data that is being loaded.
completionHandlerThe block to call when the AppState is finished downloading: ^(GPGAppStateLoadStatus status, NSError *error)
conflictHandlerThe block to call in order to handle local modifications to the data: ^(NSNumber *key, NSData *localState, NSData *remoteState) Return your resolved data from this callback to apply it.
- (void) updateForKey: (NSNumber *)  key
completionHandler: (GPGAppStateWriteResultHandler)  completionHandler
conflictHandler: (GPGAppStateConflictHandler)  conflictHandler 

Writes the local AppState to the cloud.

Call this after making local modifications to an AppState through the setStateData method. conflictHandler is called if the current modifications were performed on stale data (modifying before downloading the latest).

Parameters:
keyThe key for the AppState data that is being updated.
completionHandlerThe block to call when the AppState is finished downloading. ^(GPGAppStateWriteStatus status, NSError *error)
conflictHandlerThe block to call if there is a conflict. ^(NSNumber *key, NSData *localState, NSData *remoteState) Return your resolved data from this callback to apply it.
- (void) clearForKey: (NSNumber *)  key
completionHandler: (GPGAppStateWriteResultHandler)  completionHandler
conflictHandler: (GPGAppStateConflictHandler)  conflictHandler 

Initiates a request to clear the AppState data for the given key.

The version associated with the key is ticked after a successful clear action. Note that a cleared value for key still counts against the quota on number of keys.

The completionHandler block will be called upon completion of the request. If the request fails in any way, an error will be passed to the block.

Parameters:
completionHandlerA block of the form: ^(NSError *error).
conflictHandlerA block of the form: ^(NSNumber *key, NSData *localState, NSData *remoteState)
- (void) deleteForKey: (NSNumber *)  key
completionHandler: (GPGAppStateWriteResultHandler)  completionHandler 

Initiates a request to delete the AppState data.

Only trusted testers of the app are allowed to perform this action. This will completely erase the data for this key, including all version information.

The completionHandler block will be called upon completion of the request. If the request fails in any way, an error will be passed to the block.

Parameters:
keyThe key for the AppState data that is being deleted.
completionHandlerA block of the form: ^(GPGAppStateWriteStatus status, NSError *error).

Оставить отзыв о...

Текущей странице
Play Games Services for iOS
Play Games Services for iOS