Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

floyde

macrumors 6502a
Original poster
Apr 7, 2005
808
1
Monterrey, México
Hi guys, I'm working on my first iPhone project and I could use some help. I'm looking into data storage on the iPhone and so far I've got Core Data (which I think will be available until OS 3.0), SQL Lite and Xml.

I've worked a lot with non-phone mobile devices (mostly windows ce), but I've never used a database for these types of projects. Since it's been a while since I last developed desktop apps, I'm much more proficient at Xpath than I am at sql (although I'm still pretty decent at it).

I can't get into the details of the data, but I imagine using just a few hundred records. What would you guys recommend? Is there a significant difference in performance between SQL Lite and Xml? Is one of them easier to use?

Thanks
 
OO, RDBMS, or hierarchical

I haven't actually done iPhone programming so I don't know about performance, but unless you're sure performance is going to be an issue you might not want to make a decision based on data retrieval speed.

However, the 3 choices you enumerated fall into these 3 data model categories: object-oriented data (CoreData), relational database (SQL lite), or hierarchical (XML).

You might want to consider which data model most closely matches your application. Note that the first two data models can be structured to provide hierarchical relationships. I think it is possible to make object-oriented data have the same sort of constraints used in relational databases, but you may have to write all that constraint enforcement code yourself.

My guess is that using SQL lite will increase your code size, which shouldn't really be that big an issue. XML has the benefit of being human-readable. Someone knowledgeable about CoreData probably can tell you what its advantages are. I'm not familiar with it.

Anyway, if you think that you're best at coding XML then you might want to use that for prototyping with the idea that you can go back and re-do the data storage code.

My 2 cents.
 
Core Data will use either XML or SQLite, it's configurable for each database. But I'm not sure if the iPhone allows this. If you're using CD I would recommend SQLite since you're not going to be interacting directly with the database.
 
Is the data static or will it change while the app is running?

You should also consider using a plist. It will have similar performance to the xml file but may be easier to deal with.

sqlite will be most performant and most flexible. If you might eventually get to 1000 or more records you should probably go that way.
 
Thanks for the input guys. I'm currently leaning toward SQL Lite. I think it could come in handy in a future project and I'm better off learning to use it from the start.

Is the data static or will it change while the app is running?

The user creates the data, so it won't be static.
 
Thanks for the input guys. I'm currently leaning toward SQL Lite. I think it could come in handy in a future project and I'm better off learning to use it from the start.



The user creates the data, so it won't be static.
Go for SQLite. Parsing straight XML (w/o using Core Data, which is supported in 3.0) can be painfully slow if you have over, say, 50 entries. SQLite is very fast in terms of loading.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.