custom properties in iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tikilittle
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3
Joined: Thu Feb 17, 2011 12:32 am

custom properties in iOS

Post by tikilittle » Fri Mar 11, 2011 11:05 pm

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?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: custom properties in iOS

Post by Klaus » Sat Mar 12, 2011 12:25 pm

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

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: custom properties in iOS

Post by hliljegren » Sun Mar 13, 2011 8:50 pm

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
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: custom properties in iOS

Post by BvG » Sun Mar 13, 2011 11:15 pm

you can simply save the stack, anywhere you'd store text files too.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

tikilittle
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3
Joined: Thu Feb 17, 2011 12:32 am

Re: custom properties in iOS

Post by tikilittle » Mon Mar 14, 2011 7:03 pm

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

Post Reply