Local storage/array losing data

Discussion and feedback on Construct 2

Post » Mon Feb 29, 2016 2:31 pm

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.
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Post » Mon Feb 29, 2016 11:55 pm

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.
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Post » Tue Mar 01, 2016 2:31 am

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.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Tue Mar 01, 2016 9:51 am

Silverforce wrote:Arrays stored in LocalStorage keys as a JSON?


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

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?
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Post » Tue Mar 01, 2016 9:54 am

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?
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Tue Mar 01, 2016 9:58 am

Silverforce wrote: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?
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Post » Tue Mar 01, 2016 10:10 am

RBuster wrote:
Silverforce wrote: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.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Tue Mar 01, 2016 10:31 am

Silverforce wrote:
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.
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Post » Tue Mar 01, 2016 10:47 am

@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.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Tue Mar 01, 2016 11:06 am

Asmodean wrote:@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
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests