Property list or sqlite for static data? Property list or sqlite for static data? sqlite sqlite

Property list or sqlite for static data?


It sounds like you intend to distribute some data with your application. A property list is probably the easiest to maintain, but it will be loaded into memory all at once. This could eat up a lot of the device's memory.

An sqlite database, on the other hand, will load only the data you request. I'm not sure how your data is structured, but you could quite easily create key-value pairs with a single database table. (A single table with a key column and a value column) Then, if it were me, I'd write an Objective-C class to wrap the database queries so I can write easy statements like:

NSString *welcomeText = [[MyData sharedData] dataWithKey:@"WelcomeText"];

Getting the data into the database in the first place doesn't have to be difficult. You can use the command line sqlite3 utility to bulk load your data. There's a command called .import that will import your data from a text file.

Hope this gets you moving in the right direction!


I'd go with a sqlite solution. The apps I am working on now, which are just apps to help me learn iPhone development, mostly all use sqlite. I use the sqlite plugin for firefox to help with maintaining the database, which works surprisingly well. https://addons.mozilla.org/en-US/firefox/addon/5817

As Alex suggested using a wrapper class would also be the best way to go.


Don't forget with 3.0 you can use a CoreData layer around SQLlite which may make it more appealing to you.