如何在iphone上的whatsapp上共享图像+文本标题(URL)? [英] How Can I share image +text caption(URL) on whatsapp from iphone?

查看:470
本文介绍了如何在iphone上的whatsapp上共享图像+文本标题(URL)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WhatsApp上使用了以下代码来共享图像,但我无法使用以下代码设置标题文本。



我尝试了<$ c的注释属性$ c> UIDocumentInteractionController ,但是在WhatsApp开发者表单中没有为注释指定任何键。



我知道我们可以做到通过使用 UIImageGraphicContext ,但我需要共享URL作为标题

  if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@whatsapp:// app]])
{
NSString * savePath = [NSHomeDirectory()stringByAppendingPathComponent:@Documents / whatsAppTmp.wai ]。

[UIImageJPEGRepresentation([UIImage imageNamed:@Convenor- image-SURANA1.png],1.0)writeToFile:savePath atomically:YES];

_documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
_documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@wwww.google.comforKey:@whatsappCaption];

_documentInteractionController.UTI = @net.whatsapp.image;
_documentInteractionController.delegate = self;

[_documentInteractionController presentOpenInMenuFromRect:CGRectMake(0,0,0,0)inView:self.view animated:YES];

} else {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@Alert。消息:@Por favor,instale Whatsapp。 delegate:nil cancelButtonTitle:@EstábemotherButtonTitles:nil];
[alert show];
}


解决方案

你不能预先填写标题在whatsapp上分享图像。 Facebook已经从Facebook,Instagram上弃用了这个功能。



你可以发送文字或图像。但是无法以编程方式预填标题。



问题中的代码可以很好地发送图像。要发送纯文本,您可以使用下面提到的链接的参考:




I have used following code for share image on WhatsApp but I am unable to set the caption text using following code.

I have tried annotation property of UIDocumentInteractionController,But in WhatsApp developer form there is not any key is specified for annotation.

I do know that we can do it by using UIImageGraphicContext, But I need to share URL as caption

if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]])
{
    NSString * savePath  = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];

    [UIImageJPEGRepresentation([UIImage imageNamed:@"Convenor- image-SURANA1.png"], 1.0) writeToFile:savePath atomically:YES];

    _documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
    _documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"wwww.google.com" forKey:@"whatsappCaption"];

    _documentInteractionController.UTI = @"net.whatsapp.image";
    _documentInteractionController.delegate = self;

    [_documentInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated: YES];

} else {
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Alert." message:@"Por favor, instale Whatsapp." delegate:nil cancelButtonTitle:@"Está bem" otherButtonTitles:nil];
    [alert show];
}

解决方案

You cannot pre-fill caption while sharing image on whatsapp. Facebook has already deprecated this functionality from Facebook, Instagram also.

You can either send a text or an image. But programmatically pre-filling caption is not possible.

The code in the question is fine to send an image. In order to send a plain text you can use the reference of below mentioned link:

http://www.whatsapp.com/faq/en/iphone/23559013

NOTE: Setting caption programmatically is not possible.

Hope this helps!

这篇关于如何在iphone上的whatsapp上共享图像+文本标题(URL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆