how to download the iphone app update to replace the old sqlite database


i use sqlite database on my iphone app and

i need to update this database from the internet from my server

how i can download the new database and delete the old database

and recopy the new database to document directory

  1. Download your file with +[NSData dataWithContentsOfURL:].
  2. Close sqlite DB, if opened.
  3. Remove old DB file (may be just rename - if something went wrong with downloaded data, you may revert to prev. version of a DB faile) with -[NSFileManeger removeItemAtPath:error:]
  4. Write downloaded data to a DB file with -[NSData writeToFile:atomically:].