loadAllGameData callback

Hi!
I have seen a rare behaviour on iOS load callback. I’m using a single file for synchronization between user devices. I expect that a single file is on cloud when I call loadOneGameData. However I’m getting two callbacks for every device that had used the saveGameDataBinary (one with the savedGame and the null termination).

I’ll give you and example of three devices (iPad Air, iPhone 6 and iPhone 7). Starting with a clean user (never save for the game), perform the next steps (loads and saves are always with the same filename):

  1. Do a saveGameDataBinary on iPad Air.
  2. Do a loadOneGameData on iPhone 6. Working as expected, I get 2 callbacks, the savegame from the iPad Air and the null terminator.
  3. Do a saveGameDataBinary on iPhone 6.
  4. Do a loadOneGameData on iPhone 7. Not working as expected. I should get only 2 callbacks, the savegame from the iPhone 6 (last device saving with the filename) and the null terminator. Instead, I’m getting 4 callbacks, the savegame from iPad Air, a null terminator, the savegame from iPhone 6 and other null terminator.
  5. This can be repeated and getting 2 more callbacks for every new device.

On Android, it works as I think is the correct behaviour, loading a single savegame (the last one) with its null terminator. @htlxyz Can you help me on this?

Thanks!
fryderyk

No news? Maybe @nite or @yinjimmy can help with this? :slight_smile:

@fryderyk88

the filename and content is exactly same?

loadOneGameData will fetch all filename and compare with your provide argument filename , seem like, there are three same filename store.

The filename is the same but the content not, which is very confusing to me.

If I save with name MY_FILENAME with an iPhone and then I want to overwrite the file saving with MY_FILENAME on an iPad, that operation is not possible. SDKBOX Play somehow creates 2 files in iCloud for the same filename and when I do a loadOneGameData on any device I get the two saves with their 2 null terminators.

So in fact, there are different files with the same name but that is not the behaviour I expected (on Android it is 1 filename - 1 save)

The “Savedgamedata” structure includes a timestamp, use the latest one for temporarily temporarily If you ’ re in a hurry. and sorry about the inconvenience.

We’ll look in this issue, why Gamekit does not rewrite when same file name.

as apple’s document,

When a game is saved, if there is already a saved game with the same name, the new saved game data overwrites the old saved game data. If there is no saved game with the same name, a new saved game is created.

https://developer.apple.com/documentation/gamekit/gklocalplayer/1520527-savegamedata

there have two issue in your steps:

  1. the new data not overwrite the old one(maybe apple’s issue, we will look into this.)
  2. you got four callback(include two null terminator, should be just one null terminator), old data(iPad), null terminator, new data(iPhone6), null terminator. (we will fix this)

what’s your iPhone, iPad iOS version?

Well, I can’t use the timestamp because there are null terminators between the files, so I cannot be sure when SDKBOX Play has finished sending callbacks to me.

About the hurry… this has been detected on the last QA process before worldwide launch (planned for this week). However, I think this is a critical service for us so I prefer waiting for a sdkbox release that fix this. Can you give me a estimated release data? :slight_smile:

I’m getting the info about devices, I’ll post soon with it

The info about devices (the example of 2 devices was a simplified version, real case is that we have 5 savegames for the same filename for our iCloud account):

iPhone 5S - iOS 10.3.3
iPad Air 2 - iOS 10.3.2
iPad Mini 2 Retina - iOS 10.2.1
iPhone X - iOS 11.3.1
iPhone 8 - iOS 11.2.2

However, I don’t think it is a iOS version issue, from Apple documentation:
Conflicting saved games
With users having multiple devices, it is not unusual for a player to be playing the same game on different devices at the same time. Because of this, it is possible to have multiple saved games with the same name and from different devices. It is up to your app to find any conflicting games and fix the conflict.

After determining that there is a conflict between saved games, you need to create an array containing only the GKSavedGame objects for the conflicting games. You then send the array to the resolveConflictingSavedGames:withData:completionHandler: method. This method resolves any saved game conflicts and modifies the array so that it does not contain any saved game conflicts.

This is the link (the “Conflicting saved games” section is at bottom):
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/GameKit_Guide/SavedGames/SavedGames.html

It seems SDKBOX Play is not using this feature so games accumulate a savegame file for every device. I think there are 2 solutions:

  1. SDKBOX Play manages this automatically, so it works the same on Android and iOS.
  2. Expose a resolve conflict method on the API.

If you want my opinion, I prefer the first option :slight_smile:

yes, maybe it’s a conflicts, we will fix this ASAP.

and the multi null terminators, we fixed it. now, there should be just one null terminator.
you can use this for test. (you can use timestamp now if have multi filename callback.)

Thank you very much !

have a try, resolve conflict automatically.

https://drive.google.com/open?id=1uHnNwj0cBKWIZqerCuaKCrPeVpnpOc5A

OK, sorry for the delay. The first version you post is working. No null terminators between saves :slight_smile:

I will try the last one now and report you along today.

I have tested the resolve conflicts version and seems to be working flawlessly although the game will reenter QA on monday, next week, so I will post then with their results.

Anyway I can just say great work and thanks! :slight_smile:

(edit) I’m sorry @htlxyz, just forget this post. For those who have this issue, don’t use Application Loader. Just submit your game through XCode Organizer.

(original post)
I have another issue. When submitting to Apple Store (so QA can test the game through test flight) I’m getting this:
ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value '' for key 'com.apple.developer.icloud-container-environment' in 'Payload/My Game.app/My Game' is not supported. This value should be a string value of 'Production'"

I haven’t touched anything since last submit with the exception of updating the sdkbox play library, Maybe the error is related to some config in the SDKBOX Play package you gave to me? (the one with the auto resolve conflict)

As I promised, I’m here to post the results from QA. Everything is working now!!

Released worldwide on Android today and sent to iOS revision to release worldwide as soon as possible :slight_smile:

Thanks all SDKBOX team for the quick fixes! :slight_smile:

I am facing same issue. Whats the workaround?

I have a flag to check if it is the very first time after installation I have fetched for savegames. If is the first time and I get no info on response, I set a timer of about 3 seconds and I fetch for savegames (and set the flag to NO, this operation is done only once per installation). I told you, it’s a very nasty workaround, but I hope it helps!

Unfortunately, this solution is not working for me. On first run, if I keep on retrying, I get game state after 25-30 seconds. This time interval is not constant. Sometimes, I get game state on first call too. Problem is, I am unable to identify if game state is nil because of genuine first run, where user actually dont have any game state in icloud, or is it nil because of the apple GameKit api issue. In later case, I need to restrict game state posting until correct game state is retrieved otherwise user actual game state will be overwritten by new game state.