English 中文(简体)
禁用 iCloud 吗?
原标题:disable iCloud?

我不想使用 iCloud, 我的最后一个版本被苹果公司标记为使用它, 甚至认为我从来没有设置过任何东西。 我的所有服务都用iCloud 的复选框关闭了。 我没有添加任何应享待遇 。

#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;
}

所以,我现在正在尝试上面的代码样本。

我这样称呼它:

[self addSkipBackupAttributeToItemAtURL:"/var/apps/xxxxx/myapp/library/mydatabase.db"]

我没有搞错 但该死的iCloud仍然认为 它会备份它。

我是否需要修改上面的程序? 我发送了一个静态字符串, 如果有不同吗? 我有一个NSString 与坠落路径相连接, 但程序需要一个 URL 。 我不知道如何做到这一点, 或者它有区别 。

最佳回答

将您的文件路径设置在文件 Path 字符串中 。

NSURL *filePathURL = [[NSURL alloc]  initFileURLWithPath:filePath];
[self addSkipBackupAttributeToItemAtURL:filePathURL];
问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签