ios - 如何直接将文本和图像共享到whatsapp
<p><p>我需要将 <code>image</code> 和 <code>text</code> 直接 <code>share</code> 到 <code>WhatsApp</code>。我尝试使用 <code>actionsheet</code> 和 <code>UIDocumentIntractionController</code>。</p>
<p>我尝试使用此代码:</p>
<pre><code>if ([ canOpenURL: ]){
[AdDetailsViewController processImageDataWithURLString:self.strThumbImage andBlock:^(NSData *imageData) {
self.watsappShareimg = [initWithData:imageData];
}];
UIImage * iconImage = self.watsappShareimg; //;
NSString * savePath= ;
;
self.documentationInteractionController = ];
self.documentationInteractionController.UTI = @"net.whatsapp.image";
self.documentationInteractionController.delegate = self;
;
} else {
UIAlertView * alert = [ initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
;
}
</code></pre>
<p>提前谢谢你</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>你可以使用 <code>UIActivityViewController</code> 来分享 <code>image</code> , <code>text</code> 或 <code>URL</code> 。这是 Apple 默认的 share 方法</p>
<pre><code>NSString *shareText = @"This is Sharable text";
UIImage * image = ;
NSArray *array_Object = @;
UIActivityViewController *obj_activity = [ initWithActivityItems:array_Object applicationActivities:nil];
</code></pre>
<p>你可以试试上面的代码但是<a href="https://www.whatsapp.com/faq/en/iphone/23559013" rel="noreferrer noopener nofollow">https://www.whatsapp.com/faq/en/iphone/23559013</a>
在这个 <code>Link</code> 他们有 <code>提到</code> 只共享独立文本。对于 <code>Image</code> 、<code>audio</code> 、<code>Video</code> 使用 <code>DocumentationController</code>。</p></p>
<p style="font-size: 20px;">关于ios - 如何直接将文本和图像共享到whatsapp,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/36170306/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/36170306/
</a>
</p>
页:
[1]