Rejected by apple because of sqlite db in documents folder

I have a sqlite db using the FMDB wrapper that puts the db in the documents folder on startup. The user can also upload files via itunes to the document folder.

But appstore rejected the app as follows:

When file sharing is turned on, the All Documents folder is used for file sharing. Files that are not intended to be accessed by users through file sharing should be stored in another part of your application package. If your application does not require file sharing, the UIFileSharingEnabled key in Info.plist should not be true.

Is there any workaround to put the db somewhere or restrict it in the docs folder to be apple approved.

+3


source to share


1 answer


You will need to change the file path from the document directory to the Cache directory:

Find this in your NSDocumentDirectory code and replace it with "NSCachesDirectory" and let it be the same as your database will be automatically moved to the cache directory on startup and Apple won't reject it either. :)

Hope it helps.



EDIT: To set up your own database path, pass the string "cacheDirectoryPath" in your code instead of your path, below code will create this cacheDirectoryPath for you:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *cacheDirectoryPath = [paths objectAtIndex:0];

      

+4


source







All Articles