如何通过iOS在WhatsApp上共享内容 [英] How to share content on WhatsApp from iOS

查看:490
本文介绍了如何通过iOS在WhatsApp上共享内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序向WhatsApp共享一个网址链接和一些文本消息.我如何共享内容?

I would like to share one Url link and some text message into WhatsApp from my application. How can i share content?

我只有文本提供了此代码

I got this code for only text

NSString * msg = @"Trueman India Magazine";
NSString * urlWhats = [NSString stringWithFormat:@"whatsapp://send?text=%@",msg];
NSURL * whatsappURL = [NSURL URLWithString:[urlWhats stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

if ([[UIApplication sharedApplication] canOpenURL: whatsappURL])
    {
        [[UIApplication sharedApplication] openURL: whatsappURL];
    }

但是我如何在WhatsApp中共享我的URL链接?

but how i share my url link in WhatsApp?

推荐答案

在文本中包含普通链接,例如:

Include the plain link inside the text, e.g.:

NSString * msg = @"Trueman India Magazine http://www.truemanindiamagazine.com";

将链接发送给某人后,链接将被生成/可插入

The link will be generated/tappable after sending it to someone

这篇关于如何通过iOS在WhatsApp上共享内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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