Where to save the local database created for iphone application?

I developed an application that loads fully static content. I store data larger than 4 mb. Without this content, the application will not work. In my case, where should I save the local database (folder with documents or folder with library).

My application was rejected because it was reserved for iCloud storage.

1) Where should I save the database? In the Library folder or inside the Documents folder?

2) Since the apple rejected my application, I believe that I should not backup the database for iCloud. Please correct me if I am wrong.

3) In my application, I also take a screenshot and save it in the document directory to attach it by mail. Can I save a screenshot in the document directory or save it in a cache folder? Refresh.

Please send me the correct way to implement the database.

thank

+2
source share
1 answer

Please use the code below in your application before saving the database in the document directory.

-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    const char* filePath = [[URL path] fileSystemRepresentation];

    const char* attrName = "com.apple.MobileBackup";
    u_int8_t attrValue = 1;

    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);

//  NSLog(@"Attributs : %d and Path : %@",result,URL);
    if (result != 0) { 

        NSLog(@"File Backup Attribute setting error");

    }

    return result == 0;
}
0
source

All Articles