Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.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-导出多个pdf_Ios_Objective C_Iphone_Pdf_Export - Fatal编程技术网

iOS-导出多个pdf

iOS-导出多个pdf,ios,objective-c,iphone,pdf,export,Ios,Objective C,Iphone,Pdf,Export,在我的应用程序中,我想实现导出多个pdf文件的功能 目前,我只能使用以下代码导出pdf文件: // get local path url NSURL *url = [self getFileURLWithIndexPath:indexPath]; if(url) { BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:[url path]]; if(!fil

在我的应用程序中,我想实现导出多个pdf文件的功能

目前,我只能使用以下代码导出pdf文件:

    // get local path url
    NSURL *url = [self getFileURLWithIndexPath:indexPath];
    if(url) {

        BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:[url path]];
        if(!fileExists) {
            NSLog(@"%@", [url path]);
        }

        self.docController = [UIDocumentInteractionController interactionControllerWithURL:url];
        [self.docController setDelegate:self];
        BOOL canOpenFile = [self.docController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
        if(!canOpenFile) {
            // No reader PDF
        }
    }
url
是本地url路径。 此方法将弹出,我可以在其中选择要导出的iBook。 但我不知道如何导出多个文件,谁能帮我。。。?
谢谢!

您可以使用UIActivityViewController导出多个文件,并可以在UIDocumentationInteractionController中打开,它为管理用户与本地系统中文件的交互提供了应用内支持

NSArray *dataItems = @[pdf1, pdf2, pdf3];
UIActivityViewController *activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:dataItems
                                  applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:^{

}];

谢谢@abdullahselek,它可以与电子邮件和空投分享!但您是否也可以指定在显示UIActivityViewController后如何使用UIDocumentationInteractionController在iBooks中保存这些PDF?我只看到一个电子邮件选项。Thanksry添加排除的类型,如
//尝试添加排除的类型activityViewController.excludedActivityTypes=@[UIActivityTypeCopyToPasteboard]和更多信息活动类型再次感谢@abdullahselek。添加排除的类型并不能真正帮助我。在互联网上研究之后,我发现我们不能同时打开多个文档。但我还是选择了你的答案作为最好的解决方案,它确实帮助了我:)