在我的应用中集成iOS / whatsapp。分享图片和文字同时到whatsapp

时间:2014-11-17 21:03:50

标签: ios image text share whatsapp

有没有办法在一个动作中将我的应用中的图片和文字分享到whatsapp?

我只能找到一个Android解决方案。 iOS必须有可能吗?希望任何人都有解决方案!

我在这里找到了图片和文字的解决方案,但我正在寻找Android提供的选项;从我的应用程序,在一个动作,发送图片和文本到WhatsApp联系人。

非常需要帮助,尝试了所有内容并随处搜索!请问专家请站起来:)!在此先感谢,希望收到你的来信!

1 个答案:

答案 0 :(得分:1)

WhatsApp有“自定义网址方案”和“文档互动”(http://www.whatsapp.com/faq/en/iphone/23559013)。

但看起来它不支持设置文本的注释,如Instagram(http://instagram.com/developer/mobile-sharing/iphone-hooks/

这是分享但没有文字的方式。

self.documentationInteractionController =[UIDocumentInteractionController interactionControllerWithURL:jpegFileURL];
self.documentationInteractionController.delegate = self;

self.documentationInteractionController.UTI = @"public.jpeg";
self.documentationInteractionController.UTI = @"net.whatsapp.image";

// NOT WORKING - Found this solution, no success
self.documentationInteractionController.annotation = @{@"message":@"Text here",@"text":@"Text here"};

// NOT WORKING - Found other solution, no success
self.documentationInteractionController.annotation = [NSString stringWithFormat:@"text=Text here"];

// WORKING - BUT only for instagram
self.documentationInteractionController.annotation = @{@"InstagramCaption":@"Text here"};

[self.documentationInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];

希望有人对问题有完整的答案,我也坚持使用图像和文字组合。