直接将图像分享给WhatsApp

时间:2017-08-20 22:24:06

标签: ios share whatsapp

我想直接与WhatsApp共享图像,而不显示任何中间控制器,如UIDocumentInteractionController或UIActivityController。

官方的WhatsApp文档没有说明直接图像共享,乍一看直接共享似乎是不可能的。

但我知道这是可能的。 App Store中至少有2个应用程序可以执行此操作:

  1. “粘性AI”
  2. WorkFlow https://itunes.apple.com/us/app/workflow/id915249334?mt=8
  3. Workflow如何做到这一点? 提前谢谢。

    更新:我在这里找到了一些有趣的东西:http://resources.infosecinstitute.com/ios-application-security-part-30-attacking-url-schemes/#gref。 有一个暗示存在“whatsapp:// image /%@”url scheme。

2 个答案:

答案 0 :(得分:0)

通过LeoNatan @ github找到解决方案。效果很好。

https://github.com/LeoNatan/LNExtensionExecutor/

答案 1 :(得分:0)

我做到了这一点并且有效。

UIImage *image = [UIImage imageNamed:@"your_image_name"];
NSArray *activityItems = @[image];
UIActivityViewController *activityViewControntroller = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityViewControntroller.excludedActivityTypes = @[];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
{
activityViewControntroller.popoverPresentationController.sourceView = self.view;
activityViewControntroller.popoverPresentationController.sourceRect = CGRectMake(self.view.bounds.size.width/2, self.view.bounds.size.height/4, 0, 0);
}
[self presentViewController:activityViewControntroller animated:true completion:nil];
相关问题