来自:https://developer.apple.com/library/ios/#qa/qa1719/_index.html
您可以使用以下方法设置"不备份"扩展属性.每当您创建不应备份的文件或文件夹时,请将数据写入文件,然后调用此方法,并将URL传递给该文件.
#include <sys/xattr.h>
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
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;
}
Run Code Online (Sandbox Code Playgroud)
可以找到更多信息:https://developer.apple.com/icloud/documentation/data-storage/
| 归档时间: |
|
| 查看次数: |
7155 次 |
| 最近记录: |