Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 从iCloud中删除项目-“无法在未同步的项目上禁用同步。”_Objective C_Cocoa_Icloud - Fatal编程技术网

Objective c 从iCloud中删除项目-“无法在未同步的项目上禁用同步。”

Objective c 从iCloud中删除项目-“无法在未同步的项目上禁用同步。”,objective-c,cocoa,icloud,Objective C,Cocoa,Icloud,在我的应用程序开始时,我想从iCloud中永久删除一些项目 但在任何情况下,控制台都告诉我不能在未同步的项目上禁用同步 dispatch_async(globalQueue, ^(void) { NSFileManager *fileManager = [[NSFileManager alloc] init]; NSError *error = nil; // Move the file. BOOL success = [fileManager setUbiqui

在我的应用程序开始时,我想从iCloud中永久删除一些项目

但在任何情况下,控制台都告诉我不能在未同步的项目上禁用同步

dispatch_async(globalQueue, ^(void) {
    NSFileManager *fileManager = [[NSFileManager alloc] init];
    NSError *error = nil;
    // Move the file.
    BOOL success = [fileManager setUbiquitous:NO itemAtURL:removeItemURL
                               destinationURL:dest error:&error];

    dispatch_async(dispatch_get_main_queue(), ^(void) {
        if (! success) {
            NSLog(@"MEGA ERROR %@", [error userInfo]);
        }
    });
});

似乎你想从ubiquity中删除的文件不在那里。这就是错误消息所说的。您是否通过NSMetadataQuery检查文件是否在iCloud中?

这是我第一次没有看到文件的错误URL,但您是对的,该方法找不到文件,因为我忘记了参数项URL中的Documents文件夹。自然:非常感谢