Ios 如何通过UIDocumentInteractionController共享多个文件?

Ios 如何通过UIDocumentInteractionController共享多个文件?,ios,objective-c,facebook,Ios,Objective C,Facebook,我正在尝试实现将多个文件共享到Facebook、mail、googledriver和whatsapp 我可以通过UIDocumentInteractionController共享一个文件,如下代码所示: NSString *filePath = [NSString stringWithFormat:@"%@/%@", directory, [fileList objectAtIndex:selectedIndexPath.row]] ; url = [NSURL fileURLW

我正在尝试实现将多个文件共享到
Facebook
mail
googledriver
whatsapp

我可以通过
UIDocumentInteractionController
共享一个文件,如下代码所示:

    NSString *filePath = [NSString stringWithFormat:@"%@/%@", directory, [fileList objectAtIndex:selectedIndexPath.row]] ;
    url = [NSURL fileURLWithPath: filePath] ;

    documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
    [documentInteractionController setDelegate:self];
    documentInteractionController.UTI = @"net.whatsapp.image";
    [documentInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];
如何通过
UIDocumentInteractionController
共享多个文件而不使用
UIActivityViewController

如果使用
NSMutableArray
,并添加
url
的多个对象。如何将
NSMutableArray
设置为
UIDocumentInteractionController


提前感谢。

要共享多个文件,您可以使用UIActivityViewController

UIImage *image = [UIImage imageWithCGImage:self.imgView.image.CGImage];

NSArray* dataToShare = @[image, image2, image3];  // Any data you want to share.

UIActivityViewController* activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:dataToShare
                                  applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:nil];

这可能会对您有所帮助。

因此,
UIDocumentInteractionController
无法共享多个文件?根据文档“文档交互控制器与委托对象一起提供应用程序内支持,用于管理用户与本地系统中文件的交互。例如,电子邮件程序可能使用此类来允许用户预览附件并在其他应用程序中打开它们。使用此类可显示用于预览、打开、复制或打印指定文件的适当用户界面。“因此,使用UIDocumentInteractionController只能在两个应用程序之间共享一个文件。对我来说,建议的UIActivityViewController方法在iOS 8.4中可以很好地将多个文件作为电子邮件附件共享。但是,某些应用程序图标(如Dropbox)仅在共享单个文件时出现。