NSURLIsExcludedFromBackupKey can not be set correctly

后端 未结 2 909
一整个雨季
一整个雨季 2021-01-31 11:29

I am trying to prevent a whole folder from beeing backed up by itunes. I followed the Technical Report http://developer.apple.com/library/ios/#qa/qa1719/_index.html But it seems

相关标签:
2条回答
  • 2021-01-31 11:59

    I just fixed this in my app and while it was kind of frustrating , it all ended up working great. So , here's the code for the addSkipBackupAttributeToItemAtURL . You may want to check that out. It treats 5.0.1 and 5.0 too. You are only treating 5.1 and higher in your code.

    BUT:

    Let's say you have an NSString *path - the path to your file /folder , don't call the method with:

    [NSURL urlWithString:path]; It will work on 5.0.1 but not on 5.1 and higher.

    Instead use [NSURL fileURLWithPath:path];

    So: [MyClass addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:path]];

    In fact , I think that is the only problem with your code. Taking the method I linked to , will only provide backward compatibility , which is a great addition.

    Hope this helps.

    Regards, George

    0 讨论(0)
  • 2021-01-31 12:18

    Same problem for me. I also solved it changing the way I called addSkipBackupAttributeToItemAtURL That's the correct way:

    [MyClass addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:path]];
    
    0 讨论(0)
提交回复
热议问题