Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/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
Ios UIDocumentPickerViewController-如何从iCloud导入/导出文件_Ios_Objective C_Iphone - Fatal编程技术网

Ios UIDocumentPickerViewController-如何从iCloud导入/导出文件

Ios UIDocumentPickerViewController-如何从iCloud导入/导出文件,ios,objective-c,iphone,Ios,Objective C,Iphone,我在谷歌上搜索了一下,然后了解了如何从iCloud帐户获取文件的过程 - (void)showDocumentPickerInMode:(UIDocumentPickerMode)mode { UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"com.apple.iwork.pages.pages", @"com.ap

我在谷歌上搜索了一下,然后了解了如何从
iCloud
帐户获取文件的过程

- (void)showDocumentPickerInMode:(UIDocumentPickerMode)mode {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"com.apple.iwork.pages.pages", @"com.apple.iwork.numbers.numbers", @"com.apple.iwork.keynote.key"] inMode:mode];

documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
}

- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
if (controller.documentPickerMode == UIDocumentPickerModeImport) {
    NSString *alertMessage = [NSString stringWithFormat:@"Successfully imported %@", [url lastPathComponent]];
    dispatch_async(dispatch_get_main_queue(), ^{
        UIAlertController *alertController = [UIAlertController
                                              alertControllerWithTitle:@"Import"
                                              message:alertMessage
                                              preferredStyle:UIAlertControllerStyleAlert];
        [alertController addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:alertController animated:YES completion:nil];
    });
}
}
但在运行时,我会收到如下警告:

警告:试图显示
0x14ed4f2b0>

其视图不在窗口层次结构中

我无法打开
UIDocumentPickerViewController

您能帮我一下吗(如何在苹果帐户中启用
iCloud
开发证书权利)&我如何解决这个问题

查看此代码:
[自我呈现视图控制器:documentPicker动画:是完成:无]
。表示
self
ViewController
是否以模式显示?如果您试图推送它?错误与iCloud无关。这就是你展示文档选择器的方式。您发布的代码中的
self
是什么?当您调用presentViewController:animated:completion:时,它是否当前在屏幕上?这就是@rmaddy的意思,基本上我对这个概念是陌生的,我想一旦调用presentViewController:时,您的用户就会看到(我在这里有点吃惊…)一个苹果提供的UI,用于从文档提供程序中选择文件。此时,用户可以访问其设备上安装的所有已启用的第三方提供程序。查看以下代码:
[自我呈现视图控制器:documentPicker动画:是完成:无]
。表示
self
ViewController
是否以模式显示?如果您试图推送它?错误与iCloud无关。这就是你展示文档选择器的方式。您发布的代码中的
self
是什么?当您调用presentViewController:animated:completion:时,它是否当前在屏幕上?这就是@rmaddy的意思,基本上我对这个概念是陌生的,我想一旦调用presentViewController:时,您的用户就会看到(我在这里有点吃惊…)一个苹果提供的UI,用于从文档提供程序中选择文件。此时,用户可以访问其设备上安装的所有已启用的第三方提供商。