views:

271

answers:

2

I have a content app and would like to notify users of new content using Apple Push Notification Service, bypassing the now very long App Store submissions. Once the user receives the notification, a download update button will become enabled. The user will download an sql file plus images from my website. The sql file will execute insert statements and the images will download to the disk.

I currently load content (strings and bundle image references) into a UIWebView. Images are displayed as part of the content. How would I execute the sql file to insert new content? Then, would I also need to start referencing images on disk rather than from the bundle, which is where I put images while using App Store update submissions?

For the sql file, I can probably run some event based code once the download is complete. But then the read only database needs to be reloaded for new content to be seen. Would the user have to restart the app?

A: 

can you please help me regarding push notification service , i am new to these servive

A: 

As you said the database is read-only to your app, I would just have the APN trigger a download of a new database file and write it to disk instead of having to execute SQL statements to modify an existing db. (Unless your database is very large and you're only making a small change, when the download size would be a consideration).

In any case, if you are loading the database from the bundle it will be read-only so you can't execute insert statements on it - you will need to make a writable copy. Having the update process replace this copy in its entirety means you don't have to worry about the SQL executing correctly on each device. e.g. what happens if the app terminates mid-insert?

Similarly for images, your life would be easier if they were copied to a writable images directory on first launch rather than loaded from the bundle so you always look in the same place for them and don't care whether or not there's been an update. Just make sure you clean up anything that's no longer required after an update so you're not eating more of the user's storage than you need to.

Chris Newman