将 UIDocumentInteractionController 与 UIActivityController 结合起来分享到 Instagram、Facebook、邮件、消息等

Combine UIDocumentInteractionController with UIActivityController to share on Instagram, Facebook, to mail, message and so on

我需要能够在 Instagram 上分享照片以及 UIActivityViewController 提供的所有选项 - Facebook、Twitter、邮件等。我设法通过 [= 分享到 Instagram 11=],但需要将所有选项放在一个地方。我在 UIActivityViewController 活动中添加了自定义 UIActivity,但不知道如何从那里直接进入 Instagram。现在它只是选择了与 Instagram 选项类似的菜单,因为我提供了一个 UIDocumentInteractionController。有没有办法在一个菜单中包含所有选项?

感谢:Sharing image to Whatsapp & Facebook 已接受回复。

看起来这个选项实际上是 UIDocumentInteractionController 开箱即用的,但我错误地展示了控制器。显示所有选项的正确方法是使用:-presentOptionsMenuFromRect:inView:animated: 而不是 -presentOpenInMenuFromRect:inView:animated:
UIDocumentInteractionController 不允许像 UIActivityViewController 那样省略某些选项,但我需要将 Instagram 与其他选项一起使用,所以这是可行的方法。 我使用的代码:

NSString *documentDirectory=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString *saveImagePath=[documentDirectory stringByAppendingPathComponent:@"MyImage.png"];
NSData *imageData=UIImagePNGRepresentation(imageToUse);
[imageData writeToFile:saveImagePath atomically:YES];
NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
docIntController = [UIDocumentInteractionController interactionControllerWithURL:imageURL];
docIntController.delegate = self;
[docIntController presentOptionsMenuFromRect:CGRectMake(1, 1, 1, 1) inView:self.view animated:YES];