What are the best methods to Save and Load data for IPhone

Hi I have a question what is the best method as a beginner to save and load data for IPhone. What is the best method to understand for all beginner developer to Save and load Data for IPhone? [import]uid: 17058 topic_id: 18990 reply_id: 318990[/import]

http://techority.com/2011/04/02/how-to-save-and-load-data-in-your-app/
[import]uid: 16142 topic_id: 18990 reply_id: 73132[/import]

I did that sample from the link you gave me and I was messing around with it and got this error

attempt to perform arithmetic on field ‘twolock’ (a nil value)

how do I fix this error [import]uid: 17058 topic_id: 18990 reply_id: 73133[/import]

I use ice library for saving/loading data. It’s been great for me:

http://developer.anscamobile.com/code/ice

Naomi [import]uid: 67217 topic_id: 18990 reply_id: 73149[/import]

Hey guys,

Seconding the recommendation for Ice - the tutorial darkconsoles linked to is older and more abotu experimenting; it uses globals which you want to avoid.

Ice all the way!

Peach :slight_smile: [import]uid: 52491 topic_id: 18990 reply_id: 73156[/import]

How secure is ice against amateur plain text cheating? (root access - iFile on a jailbroken phone) [import]uid: 79135 topic_id: 18990 reply_id: 73182[/import]

I personally just use JSON.
I have all my app settings in a lua table and just need to call json.encode to convert the table into a savable string, and then use json.decode to convert in back to a table again.

…and with regards to preventing hackers on jailbroken phones… I don’t bother anymore.
I did bother before, but no matter how much effort you put in to trying to prevent it, there will always be somebody who figures out how to break it. [import]uid: 70847 topic_id: 18990 reply_id: 73186[/import]

I leapt on this as a useful topic, as I have a large table to save.
However, with 40,000 items and 7 columns, the JSON equivalent is an incredibly wasteful file format.
I think I need something binary… anything ready rubbed?
[import]uid: 108660 topic_id: 18990 reply_id: 75961[/import]

Sounds like a job for a SQLite database.

Maybe even Ice is something to think about. I haven’t used it myself, however I think it also uses an SQLite database behind the scenes. [import]uid: 70847 topic_id: 18990 reply_id: 75962[/import]

Thanks ingemar.
I think at my stage of development, a SQL Lite db is overkill. Even Ice seems OTT for the job.
I’ve elected to go for (n) rows of space delimited data.
The only caveat is that where I need an empty string, I will need to have a placeholder item.

so the test code I use to prove this was:

testtab = {}--create dummy table teststr = "jeff 10 5 x y 7"--original string --read in the values for word in teststr:gmatch("%w+") do print (word) end [import]uid: 108660 topic_id: 18990 reply_id: 75968[/import]

OK. But for me using SQLite for 40,000 records doesn’t sound like an overkill. Especially if you need to search for data within the dataset. SQLite is amazingly fast.
Also, if you use SQLite you don’t need to hold all the data loaded in a lua table. You just leave the data in the database and query for the relevant data when needed.

[import]uid: 70847 topic_id: 18990 reply_id: 75971[/import]