Excluding files from iCloud backup

我怕爱的太早我们不能终老 提交于 2019-12-02 03:20:39

问题


I'm using iOS 5.1 I use this peace of code

[pathURL setResourceValue:[NSNumber numberWithBool:YES]
                   forKey:NSURLIsExcludedFromBackupKey
                    error:nil];

The folder where I put my content is (inside app sandbox) .../Library/Application Support/, not a /Documents folder

I do not receive any errors and the result of setResourceValue: is YES

Why do I see 2 MB is Settings -> iCloud -> ... etc. where I can check the apps data size?


回答1:


Finally I found the solution by myself The clue is to apply NSURLIsExcludedFromBackupKey to root folder not to every file you want to exclude from backup

so at very beginning you should call this with (for example) "Library/Application Support" folder




回答2:


It's worth to note that you can't just set the flag on NSHomeDirectory(). It has to be internal to that path.



来源:https://stackoverflow.com/questions/12093774/excluding-files-from-icloud-backup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!