views:

270

answers:

1

hi 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

+3  A: 
  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:].
kovpas
can you write the full code i new in develop to iphone??