Getting started storing data with Xcode and iPhone

curiouswebster used Ask the Experts™
I am new to all the technologies sited [in the subject] and now need to start persisting values to the database. But I do not know where to start.

I read I scan use SQL Lite directly and persist entire object trees to the database. I wold like to experiment with both methods.

Please give me a hint where to begin.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi newbieweb,

The internet has for free and also for a fee many many things to read on this topic.

Here are two of my free sources, which I used to understand the topic.

Data Persist on the iPhone

Ray Wenderlich - Saving and Loading Data Section (scroll down)
The thing to understand is that you do not have to use SQL.  You can use just a text file if you want.  It depends on how much data you want to save and the structure of that data.

Another thing you should look at is Core Data which is Apples library that goes over the top of SQL lite.  Core Data has lots of features to help with an app where the data comes in really slowly and also for example when loading table views.

Just a couple of things to think about.

Save data to a text file.  Like in xml format
Save data to a plist file built for you in Xcode.
Save data to SQL lite (tables or xml) format
Save data using CoreData (which uses SQL Lite to save the data)
curiouswebsterSoftware Engineer


I do have a security consideration, so is the user able to view the contents of the XML, plist, SQL Lite data or Core Data?

> Core Data has lots of features to help with an app where the data comes in really slowly

Please explain what you mean by "slowly"? Do you mean when changes "trickle in"? How does Core Data help in this situation?
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

For a non-jailbroken phone, users cannot "see" the data.  For a jailbroken phone all types of data can be seen.  If I want something to be protected at least a little bit I use a file that is encrypted, but I am not sure if you can do this with a sqllite file or not.

Have a look at this tutorial which is part of the link above.  It Talks about the NSFetchedResultsController, it has a cache meaning that it only retrieves for example enough information to display on the screen of your app in a table.  Only when the user scrolls will the controller then ask for more information.  This means that less information is needed to get the app to work, and then only if the user scrolls will more information be needed.
curiouswebsterSoftware Engineer


I am considering dumping Objective-C and going with DreamWeaver and a web interface so I can also create an android version at the same time. If I do so, I presume I will continue to have access to SQL Lite but not Core Data if I make this change. True?
curiouswebsterSoftware Engineer



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial