1

I uploaded an app to Appstore but got rejected due to files being backed up to iCloud, when only user generated content should be backed up.

The thing is that I have a json in MainBundle that I use only the first time to create and update CoreData. Once I update CoreData, the json is no longer needed. I tried a solution to delete this json file but I can't since it's not permitted by Apple to delete or edit content from the Main Bundle. I, then, leave the json unused and in the Main Bundle, but the app was rejected due to this file being backed up to iCloud.

I tried this solution below, that Apple gave me to solve this problem:

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    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;
}

I still can't solve the problem, because every time I try to use this code, I get this error:

NSUnderlyingError=0x15f87bb0 "The operation couldn’t be completed. Operation not permitted"

My understanding is that I can't flag the json as "do-not-backup" because I can't delete or edit any files that are in MainBundle. I tried arguing with Apple that this happens but got the same response from them.

Any ideas on how to solve this problem?

  • what is your url for file. – codester Jul 28 '14 at 18:39
  • 1
    You can't modify files in the app bundle. And there is no need to prevent files in the app bundle from being backed up. That isn't an issue. Apple won't reject your app due to files in the app bundle. Why do you think that is the problem? – rmaddy Jul 28 '14 at 18:46
  • The JSON file is not the problem. The problem is most likely the core data file that you create from the JSON file. – user3386109 Jul 28 '14 at 18:51
  • @user3386109 exactly. I found now that the problem is the CoreData that is created in the Documents dir. Working on the solution. Thanks for the reply. –  Jul 28 '14 at 18:57
  • The core data file should be backed up assuming it is updated over time with data entered by the user. But it should NOT be stored in the Documents folder (at least if you have enabled file sharing via iTunes). – rmaddy Jul 29 '14 at 00:17
  • What was the solution to this in the end? – Paul Sturgess Feb 07 '15 at 17:02
  • 1
    @PaulSturgess As the coreData files are created inside Documents dir, I set the whole dir as not to be backed up to iCloud. Since I don't create any content inside the app, there's no need for the documents dir to be backed up. –  Feb 09 '15 at 02:09

0 Answers0