My app got rejected with for the following reason :
Your app does not follow the iOS Data Storage Guidelines, as required
by the App Store Review Guidelines.
Your app backs up 4.0 MB of data to each user's iCloud space on
launch. Please be sure to set the "Do not back up" attribute for all
data which is not generated or modified by the user. To check how much
data your app is storing:
- Install and launch your app
- Go to Settings > iCloud > Storage and Backup > Manage Storage
- If necessary, select "Show all apps"
- Check your app's storage
The iOS Data Storage Guidelines indicate that only content that the
user creates using your app, (documents, new files, edits, etc.) may
be stored in the /Documents directory - and backed up to iCloud.
Temporary files used by your app should only be stored in the /tmp
directory. Please remember to delete the files stored in this location
when the user exits the app.
Data that can be recreated but must persist for proper functioning of
your app or because customers expect it to be available for offline
use should be appended 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 kCFURLIsExcludedFromBackupKey attribute.
From what I understand, everything that is stored in the /documents folder will be stored in iCloud, and this folder should only contain data that was generated by the user. Now, I've moved all my files that were in /documents into the cache folder. However when I test the app with a device, there's still about 28kb sent into iCloud (and there is nothing in the /documents folder of that device's app sandbox, according to Organizer). My project doesn't support iCloud, so I don't understand what's being sent when there's nothing in the documents.
Is there a way to check what exactly is being sent into iCloud?
Also, my project right now targets iOS 5.0. From what I understand in 5.0 there is nothing in place to prevent an eventual purge of the cache folder. Should I only support >= 5.0.1?
Now, I've moved all my files that were in /documents into the cache folder.
Did you miss the last paragraph that you quoted? You can mark data as "do not back up," as described in that paragraph. So, leave your files in the Documents directory and mark them appropriately.
Is there a way to check what exactly is being sent into iCloud?
Point your browser at http://developer.icloud.com
Also, my project right now targets iOS 5.0. From what I understand in
5.0 there is nothing in place to prevent an eventual purge of the cache folder. Should I only support >= 5.0.1?
There is no way to do this in 5.0, so you must store everything in a place that could potentially get cleaned up by the OS like NSCachesDirectory
. I think your best bet is to handle all the cases 5.0, 5.0.1 and 5.1; use NSCachesDirectory
for 5.0 and NSApplicationSupportDirectory
for the 5.0.1 and 5.1. It's a mess, but as you noted, Apple quickly added the new attribute in 5.0.1 and improved the experience again in 5.1.
we have had apps rejected because we didn't handle all the different cases, YMMV.
However when I test the app with a device, there's still about 28kb
sent into iCloud (and there is nothing in the /documents folder of
that device's app sandbox, according to Organizer). My project doesn't
support iCloud, so I don't understand what's being sent when there's
nothing in the documents.
This applies if a user is backing up their device to iCloud, not if you are using iCloud in your app. I wouldn't worry about the extra 28KB, I have seen this in our apps as well, I think it's likely overhead of 3rd party libraries like analytics packages or other items storing small amounts of data in these locations. As noted NSUserDefaults may be stored here as well. You could download the data from the Xcode organizer and see what is being stored, if you are curious.
Here is a method for handling the do not back up attribute in 5.0.1 and 5.1.
+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL {
if (&NSURLIsExcludedFromBackupKey == NULL) {
// Use iOS 5.0.1 mechanism
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);
return result == 0;
} else {
// Use NSURLIsExcludedFromBackupKey mechanism, iOS 5.1+
NSError *error = nil;
BOOL success = [URL setResourceValue:[NSNumber numberWithBool:YES]
forKey:NSURLIsExcludedFromBackupKey
error:&error];
//Check your error and take appropriate action
return success;
}
}