我正在做一个应用程序。在这种情况下,我在运行时在DocumentDirectory中创建.txt文件。但是他们会备份到icloud。所以现在我想在ios 5版本之前停止备份。从ios 5开始,我们可以选择停止备份过程。我想将文件存储在文档中,而不是在 5.0 版本之前备份。
如果您在ios5之前安装了ios版本,则不会将数据备份到云。Becouse i-cloud 自带 ios5。
在ios5.0中,您可以使用以下功能停止备份
(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL {
NSLog(@"in add skipBackUpAtrribute method.......");
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}