Search code examples
iosobjective-cicloudgame-centergamekit

How to update GKSavedGame's description?


I'm trying to implement the Saved Games feature of GameKit (Game-Center) in my iOS game. Inspecting the GKSavedGame class reveals that there is a description field which is not documented.

[[GKLocalPlayer localPlayer] fetchSavedGamesWithCompletionHandler:^(NSArray<GKSavedGame *> * _Nullable savedGames, NSError * _Nullable error) {
    if(error == nil)
    {
        for(GKSavedGame *savedGame in savedGames) {
            NSLog(@"Name: %@", savedGame.name);
            NSLog(@"Description: %@", savedGame.description);
            NSLog(@"Unix Timestamp: %@", [NSString stringWithFormat: @"%f", savedGame.modificationDate.timeIntervalSince1970]);
        }
    }
    else
    {
        NSLog(@"Failed to download saved games metadata: %@", error.description);
    }
    downloadSavedGamesMetadataWait = false;
}];

I think this is how it's done.

Now I'm looking over possibilities to save game data and I found the saveGameData function on the localPlayer object, but it does not allow to pass a new description to it.

How can I update the description, either?


Solution

  • The answer is it's impossible. Apple uses the description field for some metadata that is generated on save like the timestamp in a human readable form. They do not support supplying an own description for the saved game.