Large files in your app documents folder can earn you a rejection
There’s nothing worse than submitting your first app to the iTunes app store, and having it get rejected. Well, OK, there are plenty of things that are worse, but it still isn’t pleasant. Bounces can happen for a variety of reasons, from Apple not liking your app’s functionality to poorly written product descriptions and everything in between. But one recently new reason for rejections may catch you off guard, I know I was.
Now that iCloud can be used to back up app contents, Apple has become sensitive to apps that produce large amounts of documents in the app document folder. After all, if you dump 50MB of files into that folder, iCloud is going to try to back it all up, and it may suck up the user’s data plan usage. So, if you’re downloading and storing content as part of your app, you have to make sure that you mark it as not requiring backup to iCloud.
Here’s a nice little function that will do just that, courtesy of Apple:
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]);
NSError *error = nil;
BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES]
forKey: NSURLIsExcludedFromBackupKey error: &error];
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
Back to Top
NSURLIsExcludedFromBackupKey flags the file as not requiring backup to iCloud. One important set of files that you should make sure you flag this way is any Core Data SQLite files that store significant amounts of data. For example, if you are storing images as blobs in your database, the file can get pretty big pretty fast.