Localstorage is cleared after App restart on ios

Get help using Construct 2

Post » Thu Nov 26, 2015 4:46 pm

Hey guys,

i've got a problem with my Localstorage under IOS.
I want to save some variables in an Array. If i set the Array width to 5 and save 3 Variables in it, it works perfectly.
Otherwise if i set the Array width to 5+ and save 5+ Variables, the localstorage is cleared when i restart the app.
I'm compiling with XDK. I tried with phonegap and Cocoon... same problem.
IOS Target version 8+.

Has anyone experience with this problem?

About an answer I would be delighted.

greetings

Domenic
B
5
Posts: 16
Reputation: 259

Post » Thu Nov 26, 2015 4:52 pm

Does this only happen after export to Ios?

Could you share your events?
You are talking about arrays, variables and localstorage..
I guess you are saving the array AsJson, which should include the size of the array, if I remember correctly..
Are you retrieving the variables from the Array in the right way?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 26, 2015 5:11 pm

LittleStain wrote:Does this only happen after export to Ios?

Could you share your events?
You are talking about arrays, variables and localstorage..
I guess you are saving the array AsJson, which should include the size of the array, if I remember correctly..
Are you retrieving the variables from the Array in the right way?


Thank you for your quick response

Yes, only on IOS. On Android it works perfectly.

https://www.dropbox.com/s/1t6irzjeysck1z1/1.png?dl=0
https://www.dropbox.com/s/7og0e3k655a20sr/2.png?dl=0
Here is my code (saving & loading).

Yes i'm using the AsJson array, but i don't know if it includes the size of the array. I set the array manually.
Yeah, on Android all variables retrieves correctly.
B
5
Posts: 16
Reputation: 259

Post » Thu Nov 26, 2015 5:28 pm

Ok..
I'm not sure why you use the variable String inbetween..
I don't see any event changing the array-size, or did you mean setting it inside the editor?
Also I'm not sure why you seperate event 13,14,15 and 16

But I can't see why this would work on android and not on iOS..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 26, 2015 5:38 pm

LittleStain wrote:Ok..
I'm not sure why you use the variable String inbetween..
I don't see any event changing the array-size, or did you mean setting it inside the editor?
Also I'm not sure why you seperate event 13,14,15 and 16

But I can't see why this would work on android and not on iOS..


I set my values to the string and save the String in the array
Yep, i set the size in the editor.
Yeah, your right. I should make one event... idk why i did that :lol:

Hmm, no problem.

Thank you for your help.
B
5
Posts: 16
Reputation: 259

Post » Sun Jul 17, 2016 8:40 am

Hi Guys,

I use r231 and after compiling with CocoonJs cloud(webview+ mode) I have construct 2 system save/load don't work.

It works fine if I compile with Phonegap but webview+ gives much more efficient CPU usage.

Please advise if any ideas to save load in CocoonJS?
B
18
S
6
G
1
Posts: 24
Reputation: 1,692


Return to How do I....?

Who is online

Users browsing this forum: 13spongg13, Cappu, Yahoo [Bot] and 5 guests