Reputation: 1037
My app has a SQLite database that users can read only. I, the developer, would like to add entries to the database from time to time and make the enlarged database available as a file on a Web server. I'd like the users to be able to "check for updates".
My question is, once a user checks and finds that an updated DB file exists, how can/should the file be downloaded to the iPhone and written over the previous version of the DB?
Does the iPhone even allow files to be downloaded and saved?
Upvotes: 1
Views: 944
Reputation: 1092
"Does the iPhone even allow files to be downloaded and saved?"
Yes, you can save files in your Applications Documents directory at run-time.
The <Application_Home>/Documents/
is a good place, since the files stored in this location are preserved when the user does iPhone backups with iTunes.
More information on Where you can write to and how here: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/FilesandNetworking/FilesandNetworking.html#//apple_ref/doc/uid/TP40007072-CH21-SW11
Upvotes: 1
Reputation: 2802
If you are connected to the SQLLite with CoreData it does not take kindly to having the storage ripped out from underneath it and replaced.
As you have a database then why not make use of the database features. To the user it is read only. To your app it can be updated. Make a HTTP request and download the updated data rows from the webserver in a suitably machine readable format, and update the data tables with that. You might even be able to just serve delta's of the data depending on what you are holding.
Upvotes: 1