禁用iCloud同步

时间:2011-10-14 19:42:38

标签: iphone ios ios5 icloud

有没有办法阻止您的应用程序数据(文档文件夹内容)同步到iCloud? (其他然后将其存储在Caches目录中,因为iOS5中的新问题执行that)我的应用程序需要在设备上存储数据,但出于安全原因,它无法同步到任何第三方(包括苹果)。

2 个答案:

答案 0 :(得分:8)

来自: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;
}

可以找到更多信息:https://developer.apple.com/icloud/documentation/data-storage/

答案 1 :(得分:0)

请参阅iOS App Programming Guide: iCloud Storage

它描述了一个应用程序必须使用iCloud权利签名,这似乎意味着如果你什么都不做,那么你应该没事。