Search code examples
iphoneiosios5appstore-approval

What's the proper way to access a canned app resource that can be updated?


We have an iOS app which uses core data and we are populating the application data with a initial database. (SQLite). And later it will download the data from internet and update the database. We are copying the SQLite database to Documents folder. Apple says this is incorrect since files in the Documents folder will automatically backup to iCloud. They don't allow it unless those files are user created ones.

Solutions they have mentioned.

  1. Set a flag to the file(On our case databse) that it wont get backup to iCloud. But this will work only in iOS 5.1 and we cant do that. we need to support iOS 4 and above. (https://developer.apple.com/library/ios/#qa/qa1719/_index.html)

  2. Maintain the files(our case its database) in the temp folder. But they mentioned to delete whatever we put on temp folder on app exit. Again this is not the solution.

But my question is if we dont delete that what's the problem? what will happen to temp folder, when users are updating to the next app version from AppStore? Will it delete the contents or will it keep whatever its on the temp folder on app update?

Or anyone one have any other solution to this problem? Appreciate your help alot.


Solution

  • After reading some documentation here is the solution I feel as correct.

    --> iCloud and iTunes do not back up the contents of the following directories:

    /AppName.app

    /Library/Caches

    /tmp

    --> Files in the following directories are guaranteed to be preserved during the update process:

    /Documents

    /Library

    So I'm copying my initial database in to the Library/Caches. And do any updation on top of that database. But I feel if the device is running on low disk spaces it might delete the contents of cache folder. In that case I check for the database existence and I copy again if it's not there. (As a precaution). But in this case user might lose some of his data. But still Apple haven't provided a proper guide for this.