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?

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

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

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

Naomi

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 :)

How secure is ice against amateur plain text cheating? (root access - iFile on a jailbroken phone)

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.

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?

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.

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:

1
2
3
4
5
6
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

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.

views:1702 update:2012/1/2 12:52:55
corona forums © 2003-2011