我正在做一个应用程序。因为我正在运行时在 DocumentDirectory 中创建 .txt 文件。但是它们将备份到 icloud。所以现在我想在 ios 5 版本之前停止备份。从 ios 5 开始,我们可以选择停止备份过程。我想将文件存储在文档中,而不是在 5.0 版本之前进行备份。
问问题
204 次
1 回答
0
如果您在 ios5 之前安装了 ios 版本,则不会有数据备份到云端。因为 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;
}
于 2013-10-24T12:51:44.440 回答