小编Bha*_*vik的帖子

如何在iphone上的whatsapp上共享图像+文本标题(URL)?

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

我已尝试过注释属性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.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];
}
Run Code Online (Sandbox Code Playgroud)

iphone ios whatsapp

14
推荐指数
1
解决办法
5063
查看次数

标签 统计

ios ×1

iphone ×1

whatsapp ×1