Page 1 of 1

custom properties in iOS

Posted: Fri Mar 11, 2011 11:05 pm
by tikilittle
We're building a iOS game and it includes a scrolling field with user profiles. We would like to save these profiles upon closing the app. Is there a way to use custom properties to save this data? We've tried custom properties and saving the substack upon closing the app, but to no avail. We know we can save to an external text file, but could we use custom properties?

Re: custom properties in iOS

Posted: Sat Mar 12, 2011 12:25 pm
by Klaus
Hi tikilittle,

no, custom properties are "just" another way to store information INSIDE of a stack.
They will also need to be stored/saved in external (text) files.


Best

Klaus

Re: custom properties in iOS

Posted: Sun Mar 13, 2011 8:50 pm
by hliljegren
My usual way of storing properties is to put them in an array. Then you could save the array by using arrayEncode. Like this:

Code: Select all

put userName into prefs["uname"]
put wantsMusic into prefs["wantsMusic"]
put showNewsAtStart into prefs["showNewsAtStart"]

# To save, you convert your array into a "text"-file 
put arrayEncode(prefs) into URL <filepath>

# To load your prefs you just do the reverse
put arrayDecode(URL <filepath>) into prefs
:-HÃ¥kan

Re: custom properties in iOS

Posted: Sun Mar 13, 2011 11:15 pm
by BvG
you can simply save the stack, anywhere you'd store text files too.

Re: custom properties in iOS

Posted: Mon Mar 14, 2011 7:03 pm
by tikilittle
Thanks Klaus, Hakan & BvG.

We would like to report success finally at storing custom properties in an iPad application. We were able to follow the excellent tutorial posted by BN on this forum 30Jan2011 titled "Splashstack and datastack for iPhone". The key for us seemed to be to add our data stack to the "Non-stack files in the application" in the "Copy Files" tab of the "Standalone Application Settings". We also added the try-catch script from BN to find the data stack in the specialFolderPath("Documents") or the specialFolderPath("engine").

Todd & Jim