GKLocalPlayer save and fetch data to iCloud issue

Hi all

I have two mystic issues with saving and fetching data to and from iCloud. Both repro only after first launch of an app.

1. [GKLocalPlayer fetchSavedGamesWithCompletionHandler:] After first attempt I can see 0 saved games (but i know that there is at least one saved game) and there is no any error. In case if I try fetch one more time (without any additional actions) even immediately after first attempt I receive saved games correctly (not 0)

2. [GKLocalPlayer saveGameData: withName: completionHandler:] After first attempt I can see error The requested operation could not be completed because local player has not been authenticated. In case if I try save one more time (without any additional actions) even immediately after first attempt I can save data successfully without any error

I found the same issue in StackOverflow, but there are no fixes...

Answered by Frameworks Engineer in 733822022

Hi there,

Thanks for the issue report. We're looking at fixing a number of authentication related issues in an upcoming release, but until then, there might be a workaround.

Are you attempting to load saved games in your authenticateHandler callback? If so, could you see if loading saved games some time shortly after that callback resolves your issue? Please report your findings.

Thanks, Brandon

Accepted Answer

Hi there,

Thanks for the issue report. We're looking at fixing a number of authentication related issues in an upcoming release, but until then, there might be a workaround.

Are you attempting to load saved games in your authenticateHandler callback? If so, could you see if loading saved games some time shortly after that callback resolves your issue? Please report your findings.

Thanks, Brandon

Hi, Brandon

I have my wrapper class for save/restore game data. For now I added dirty fix to this class. In designated initializer (before user of my class will try to save/fetch data) I call [GKLocalPlayer.localPlayer fetchSavedGamesWithCompletionHandler:nil];

So, after the initialization user of my class can call fetch/save without any restrictions because I made first GKLocalPlayer save/fetch call before

Hi Brandon,

Has this issue been fixed in a future version of GameKit? This post was a while ago now so I was hoping there was a newer version I could upgrade to so that I could remove my workaround.

Thanks :)

Same here,

  1. [GKLocalPlayer saveGameData: withName: completionHandler:] reported successed
  2. [GKLocalPlayer fetchSavedGamesWithCompletionHandler:] got 0 data

Tried to call “[GKLocalPlayer.localPlayer fetchSavedGamesWithCompletionHandler:nil];” first, still the same. Try to make thread wait 2sec before fetch, still the same.

GKLocalPlayer save and fetch data to iCloud issue
 
 
Q