I have an iPhone program with a table view. The table view gets its data from a NSMutable Array. I want people to be able to add data to that table, i.e add objects to that array. Using addObject
and reloadData
, I am able to add objects to the array, and reload the table view so that the newly added data is also displayed. However, once I re-launch the app, the newly added data is missing. My question is what is the best way to store the array in the iPhone so that at re launch i can populate the table with the user added data?
Thanks
I think these are your options.
If you just want to store a single array information you can use NSUserDefaults
one of the easiest method of storing data.A good tutorial here.
PS : Never use NSUserDefault for saving sensitive information, like login credentials. For that use KeyChain services.A simple tutorial explaining the usage here.
If you have a large set of data and looking for a database style storage, then you should look at core data. Core data is a high level API written over lower SQLite concepts and is very good. A good tutorial here and here
If you want to use database using old fashioned way (writing queries) you can use sqlite directly on iPhone. You could get good information from here, here and from this SO question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With