I am wondering about the pros and cons to using different datasets.
I have working code that uses all three of the following datasets.
- One pulls an
.xmlfile off of my server - One accesses a copy of a SQLite3 database from within the app’s bundle (it’s a copy so that I can add to it, delete from it, and save changes
- One accesses data from a
.plist.
My question is, now that I have some experience creating these datasets and displaying their data in an app, why/when would I use one over the other?
xml file off your server:
Pros: You can update the XML file at any time to provide new data to the user, good to send to other platforms
Cons: Requires a network connection, have to parse the XML into Obj-C objects, there’s no way to modify one value in an XML file without rewriting the entire file, XML files need extra metadata for parsing into the proper Obj-C types
sqlite file within your bundle:
Pros: Good for large datasets; you can do queries, sorts and read partial data; you can rewrite or add one row at a time; good to send to other platforms
Cons: Have to convert sqlite data into Obj-C objects (I like fmdb for this), to update the data you need to submit your app to Apple and have it approved
plist:
Pros: Good for smallish datasets, easy to read plist into an Obj-C container
Cons: Bad for large datasets (more than 1000 or so items), no way to update only one value without rewriting the entire file, hard to send to other platforms, have to submit your app to Apple and have it approved
Note:
You can also put a file (any format) within your bundle and also check your server for a more recent version.