My application was rejected 2 times and I lost 3 weeks :(
First submit, I excluded ONLY DIRECTORS from the backup in iCloud. Apple rejected ...
Second serve, I excluded the DIRECTORS and PHOTOS downloaded from the backup to iCloud. Apple refused again ... Apple also stated that I didnβt have a Recover function for my In-App purchase, while in fact I have a Recover button and it worked when I tested it.
I did as Apple suggested, deleting the file from the backup using NSURLIsExcludedFromBackupKey. There was an interesting comment made by MacMad on stackoverflow here :
sometimes Apple analysts believe that your data can be regenerated when itβs not. Then you will need to explain why the data should be copied.
How often does the reviewer misunderstand, and we need to explain to them that the content is needed offline and cannot be generated?
Here is the code I used to exclude my files and directories from iCloud. Do you find any problems?
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL { // There a chance the download failed, but don't assert here //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; } //Download picture from Google and exclude it from being backed-up in iCloud - (void)downloadFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *)error { if (error == nil) { // successfully retrieved this photo data; save it to disk GDataEntryPhoto *photoEntry = [fetcher propertyForKey:@"photo entry"]; // Create album directory if it doesn't already exist NSString *path = [self findOrCreateApplicationSupportSubPath:[photoEntry albumTitle]]; path = [path stringByAppendingPathComponent:[[photoEntry title] stringValue]]; if (path != nil) { // Write to disk BOOL didSave = [data writeToFile:path options:NSDataWritingAtomic error:&error]; if (didSave) { // Exclude file from being backed up in iCloud NSURL *url = [NSURL fileURLWithPath:path]; BOOL excludeBackupResult = [self addSkipBackupAttributeToItemAtURL:url]; if (excludeBackupResult == NO) { NSLog(@"Error excluding FILE from iCloud: %@", path); } // Update the download progress bar _downloadedFileCounter = _downloadedFileCounter + 1; float progress = _downloadedFileCounter / kMaleWireframeImagesTotal; [self updateProgress:progress]; // The download completed. -2 just incase a package is lost, but let the user move on... if (_downloadedFileCounter >= _downloadableFilesTotal -2) { [_panel6 downloadCompleted]; } } else { // error saving file. Perhaps out of space? Write permissions error? NSLog(@"Save anatomy picture failed: %@", error.localizedDescription); } } else { NSLog(@"downloadFetcher: Cannot create directory"); } } else { NSLog(@"downloadFetcher failed: %@", error); } } //Create directory and exclude it from being backed-up in iCloud -(NSString*)findOrCreateApplicationSupportSubPath:(NSString*)subPath { NSString *resolvedPath; NSArray *appSupportDir = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); if ([appSupportDir count] != 0) { resolvedPath = [appSupportDir objectAtIndex:0]; // Append the name of this application NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"]; resolvedPath = [resolvedPath stringByAppendingPathComponent:executableName]; resolvedPath = [resolvedPath stringByAppendingPathComponent:subPath]; NSFileManager *manager = [NSFileManager defaultManager]; if (![manager fileExistsAtPath:resolvedPath]) { // Path doesn't exist, creates it NSError *error; BOOL successful = [manager createDirectoryAtPath:resolvedPath withIntermediateDirectories:YES attributes:nil error:&error]; if(!successful) { NSLog(@"ERROR creating APP Support Sub-Directory: %@", error.localizedDescription); return nil; } else { // Exclude path from backing-up in iCloud NSURL *url = [NSURL fileURLWithPath:resolvedPath]; BOOL excludeBackupResult = [self addSkipBackupAttributeToItemAtURL:url]; if(!excludeBackupResult){ NSLog(@"Error excluding DIRECTORY from iCloud backup. This is a violation to their guideline."); return nil; } } } } else { NSLog(@"No Application Support Path available"); return nil; } return resolvedPath; }
source share