Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2.23: Apps must follow the iOS Data Storage Guidelines or they will be rejected [closed]

By uploading the app to the app store have given me this error.

2.23: Apps must follow the iOS Data Storage Guidelines or They Will be rejected

I've been watching what is wrong is that one of the files I'm using does not meet the storage requirements.

To be more specific it is a sqlite for loading maps offlines mode with route-me library.

I am using sqlite for loading map in offline mode, it seems that this map is stored as backup in iCloud, so I'm skipping storage restrictions.

Do not know how to say that this copy is not created in iCloud.

The code is as follows:

[[RMDBMapSource alloc] initWithPath: @ "map.sqlite"]; 

The file size is 23MB

any ideas?

like image 888
jmartos89 Avatar asked Mar 02 '14 23:03

jmartos89


1 Answers

Most probably you are storing your "map.sqlite" in your application's Documents directory. Sqlite files are normally copied to Documents directory so that they are writable. But iOS, by default, tries to copy or backup all the files in Documents directory to iCloud (if iCloud backup is turned on). Therefore, according to Apple's guidelines, you can do the following so that your database file is not backed up by iCloud from your Documents directory.

You can call the following function to pass the path of your "map.sqlite" as NSURL:

NSURL *url = [NSURL fileURLWithPath:yourSQLitePath];
[self addSkipBackupAttributeToItemAtURL:url];

The function is provided in Apple as:

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);

    NSError *error = nil;
    BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
                              forKey: NSURLIsExcludedFromBackupKey error: &error];
    if(!success){
        NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
    }
    return success;
}

This function makes sure that the file (provided as URL) is not backed up by iCloud.

You can also put your database files in a separate directory inside Documents directory and mark that whole subdirectory as 'do not backup' by calling this function. Hope it helps.

like image 157
novice20 Avatar answered Sep 21 '22 13:09

novice20