iphone - 禁用 iCloud 同步

标签 iphone ios ios5 icloud

<分区>

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

最佳答案

发件人: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/

关于iphone - 禁用 iCloud 同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7772767/

相关文章:

ios - Paypal 始终以波兰语打开

ios5 - 将sqlite数据库与iCloud同步

iphone - 滚动表格 View 时如何避免减速?

iphone - 如何将 HID 配置文件连接到 iOS 设备?

iphone - 在iPhone应用程序中设置UIViews大小的最佳方法(因此,在Retina和较旧的显示器上一切看起来都不错)

iPhone 应用程序安装链接

ios - respondsToSelector 无法识别已实现的选择器

objective-c - IOS5 中的 RegexKitLite

iphone - 在模拟器中第二次运行 ios 应用程序时登录

iPhone map 套件 : select location (coordinates) manually by touching MKMapView