【发布时间】:2014-10-31 11:14:04
【问题描述】:
我想从我的应用程序中将一个 URL 链接和一些短信分享到 WhatsApp。如何分享内容?
我得到此代码仅用于文本
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 链接?
【问题讨论】:
-
您是否尝试过将链接添加为像
msg这样的字符串? -
不,我不会尝试,因为在模拟器中没有安装什么应用程序。有没有可能在模拟器中安装什么应用程序?
-
你为什么还要问你是否还没有尝试过呢?请在询问之前先尝试自己进行研究。不,你不能在模拟器上安装 whatsapp,你需要一个物理设备。