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 Gu
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;
}
}
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