iOS App Rejection due to 2.23 - iOS Data Storage Guidelines

ersentekin picture ersentekin · Mar 1, 2015 · Viewed 6.9k times · Source

Here's message from Apple about rejection :

2.23 - Apps must follow the iOS Data Storage Guidelines or they will be rejected 2.23 Details

On launch and content download, your app stores 6.5 MB, which does not comply with the iOS Data Storage Guidelines.

Next Steps

Please verify that only the content that the user creates using your app, e.g., documents, new files, edits, etc. is backed up by iCloud as required by the iOS Data Storage Guidelines. Also, check that any temporary files used by your app are only stored in the /tmp directory; please remember to remove or delete the files stored in this location when it is determined they are no longer needed.

Data that can be recreated but must persist for proper functioning of your app - or because users expect it to be available for offline use - should be marked with the "do not back up" attribute. For NSURL objects, add the NSURLIsExcludedFromBackupKey attribute to prevent the corresponding file from being backed up. For CFURLRef objects, use the corresponding kCRUFLIsExcludedFromBackupKey attribute.

I checked out the data files of my application both for device and simulator. I found that if app has used for a while, it's total app data could store 5-6 MB, on launch. But I uninstalled and re-installed app and checked again, I see ~3MB data store on launch of app.

I'm not storing any Core Data databases or any other database files. But I've realized that Google Analytics and Google Tag Manager stores some sqlite data on this path : "AppData/Library". I mean it does NOT store on this path : "AppData/Library/Caches". Does it make any difference for iOS Data Storage Guidelines?

By the way, iCloud is disabled for application.

Also I'm using SDWebImage for downloading images and it stores almost 3 MB images on the launch and it stores image data on this path : "AppData/Library/Caches"

Do you have any idea that what should I do to handle this issue?

Answer

Glauco Neves picture Glauco Neves · Mar 21, 2015

I just got the same rejection message yesterday.

I use the following code in application:didFinishLaunchingWithOptions: to see what my application has inside the documents folder and what is the permission of each item about iCloud backup:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
NSArray *documents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:basePath error:nil];
NSURL *URL;
NSString *completeFilePath;
for (NSString *file in documents) {
    completeFilePath = [NSString stringWithFormat:@"%@/%@", basePath, file];
    URL = [NSURL fileURLWithPath:completeFilePath];
    NSLog(@"File %@  is excluded from backup %@", file, [URL resourceValuesForKeys:[NSArray arrayWithObject:NSURLIsExcludedFromBackupKey] error:nil]);
}

I had some files inside that folder that were synchronising with iCloud. So instead of saving those files in another place I set the resource value for the NSURLIsExcludedFromBackupKey key set to YES to exclude those files from being backed up by iCloud, like this:

NSURL *URL = [NSURL fileURLWithPath:photoPath];
[URL setResourceValue:@(YES) forKey:NSURLIsExcludedFromBackupKey error:nil];

I'm sending my app again today to see if works.

Hope this help.