从iCloud备份中排除文件 [英] Excluding files from iCloud backup
问题描述
我正在使用iOS 5.1 我使用这种和平的代码
I'm using iOS 5.1 I use this peace of code
[pathURL setResourceValue:[NSNumber numberWithBool:YES]
forKey:NSURLIsExcludedFromBackupKey
error:nil];
我放置内容的文件夹是(在应用沙箱内部).../Library/Application Support/,而不是/Documents文件夹
The folder where I put my content is (inside app sandbox) .../Library/Application Support/, not a /Documents folder
我没有收到任何错误,并且setResourceValue:的结果为是
I do not receive any errors and the result of setResourceValue: is YES
为什么我看到2 MB是设置-> iCloud-> ...等,可以在其中检查应用程序的数据大小?
Why do I see 2 MB is Settings -> iCloud -> ... etc. where I can check the apps data size?
推荐答案
最后,我自己找到了解决方案 提示是将NSURLIsExcludedFromBackupKey应用于根文件夹,而不是应用于要从备份中排除的每个文件
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
这篇关于从iCloud备份中排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!