Local storage/array losing data

0 favourites
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Something wrong is happening with the local storage with my iOS application. I'm using it with array to manage the game levels.

    After playing a few levels and close the game, when I open it again, part of the levels that has been completed appear blocked again. This issue doesn't repeat frequently and neither in the same amount of levels (I counted 5 / 7 / 14 levels for example). Sometimes it also happens when the game returns to the levels menu. The major problem is that it doesn't happen with chrome/nw in the preview mode on my computer.

    I know this is a specific question but I've to ask if anyone have this same issue because I don't know more what to do, mainly because I can't simulate the error in the browser. I've some iOS application that use Local Storage and are working very well, but none with arrays.

    Thanks in advance for any help/suggestion.

  • I remade the whole level menu to try to figure out why it's happening, but the problem still persist. Maybe if I use the Dictionary instead the Array this problem can be solved. I don't; know. Could anyone confirm it or, if is possible, give me some suggestion or point me the possibilites? I really appreciate any help.

  • Arrays stored in LocalStorage keys as a JSON?

    I do that too, it works fine for Safari on iPad Mini 2. But I did notice on iPhone 6 plus, it would reset. No idea why.

  • Arrays stored in LocalStorage keys as a JSON?

    Exactly. If I use the dictionary, it would change anything?

    [quote:3brix296]I do that too, it works fine for Safari on iPad Mini 2. But I did notice on iPhone 6 plus, it would reset. No idea why.

    I've iPhone 6 and surely it affects this version too. Is there anything I can do to fix it or do you think it has no solution?

  • I only tested with Safari preview over wi-fi, I noticed iPhone 6 Plus would not save LocalStorage properly.

    Did you use XDK or CocoonIO?

  • I only tested with Safari preview over wi-fi, I noticed iPhone 6 Plus would not save LocalStorage properly.

    Did you use XDK or CocoonIO?

    Intel XDK. I never used Cocoon.

    Bad news. I found it: http://gonehybrid.com/dont-assume-local ... ybrid-app/

    Can I use SQLite with C2? Is there another solution to store data?

  • > I only tested with Safari preview over wi-fi, I noticed iPhone 6 Plus would not save LocalStorage properly.

    >

    > Did you use XDK or CocoonIO?

    >

    Intel XDK. I never used Cocoon.

    Bad news. I found it: http://gonehybrid.com/dont-assume-local ... ybrid-app/

    It's not that problem. I had that problem in my game on iOS with with iOS8, it would wipe out localstorage when user device run low on disk space.

    That will always be a problem with iOS due to the OS itself having permissions to destroy non-system generated files.

    This bug is a new one. LocalStorage works FINE on Safari on iPad Mini 2 for me, does not work at all on Safari on iPhone 6 Plus. Same OS version, the latest.

  • It's not that problem. I had that problem in my game on iOS with with iOS8, it would wipe out localstorage when user device run low on disk space.

    That will always be a problem with iOS due to the OS itself having permissions to destroy non-system generated files.

    This bug is a new one. LocalStorage works FINE on Safari on iPad Mini 2 for me, does not work at all on Safari on iPhone 6 Plus. Same OS version, the latest.

    In this case, what kind of solution can I use to replace the local storage? The iOS version of my game was ready to be released.

  • RBuster

    'Local Storage' in Construct uses IndexedDB and it seem iOS has still some problems with it:

    https://gist.github.com/nolanlawson/08e ... 17a30c1b26

    Have you tried the deprecated WebStorage? Maybe that works.

  • RBuster

    'Local Storage' in Construct uses IndexedDB and it seem iOS has still some problems with it:

    https://gist.github.com/nolanlawson/08e ... 17a30c1b26

    Have you tried the deprecated WebStorage? Maybe that works.

    I thought about using WebStorage but I was afraid just because it's deprecated. But if it's the only solution available, I'll give it a try.

    Thanks Asmodean

  • I think WebStorage is only deprecated because of the Google Play Store. WebStorage uses the real Local Storage or Session Storage as far as I know.

  • Asmodean

    Do you know if I can use both? WebStorage to store the array and LocalStorage for the remaining data?

  • I never tried it, but I don't think that makes a problem, because WebStorage and LocalStorage uses different places to store their data.

    But be careful, session storage from WebStorage only lasts with the current browser session, you have to use local storage from WebStorage.

    https://www.scirra.com/manual/120/webstorage

  • I never tried it, but I don't think that makes a problem, because WebStorage and LocalStorage uses different places to store their data.

    But be careful, session storage from WebStorage only lasts with the current browser session, you have to use local storage from WebStorage.

    https://www.scirra.com/manual/120/webstorage

    Ok. Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I never tried it, but I don't think that makes a problem, because WebStorage and LocalStorage uses different places to store their data.

    What makes you believe that ?

    It uses browser storage. In the absolute, web and local storage store infos at the same place in the browser (not the cache, the storage, a dedicated space for those infos thanks to HTML5 specs).

    Moreover, it shouldn't solve the problem of storage files being cleared by the OS.

    I don't think using webstorage would help with the issue at hands.

    If you could somehow create files on the system and read them, that could be something considered, but I doubt this will be an easy treat, especially on Apple device.

    Shaming them for their awful software and asking them to comply better with HTML5 specs could be the only solution around.

    But they don't seem to care a lot as per they slow release cycle which goes on breaking previous features.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)