ios - 使用 WhatsApp URL Scheme 发送我的 App URL Scheme

标签 ios objective-c url nsurl whatsapp

也许我在这里遗漏了一些简单的东西,但我终生无法让我的 URL 使用他们的 URL 显示在 WhatsApp 应用程序上 方案。我有:

        NSString *stringToSend = [[NSString stringWithFormat:@"whatsapp://send?text=myAppDomain://%@moreChars",specialString] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

        NSURL *whatsappURL = [NSURL URLWithString:stringToSend];

        [[UIApplication sharedApplication] openURL: whatsappURL];

它成功启动了 WhatsApp 应用程序,但是在我选择一个联系人后,消息框没有预先填写,它仍然是空的。我做错了什么?

最佳答案

最后我得到了将自己的应用程序 iTunes URL 共享到 whatsapp 的解决方案。

NSString *string = [@"" stringByAppendingFormat:@"Share this on whatsapp \n\n https://itunes.apple.com/us/app/google-search/id284815942?mt=8"];

 string = [string stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"];
    string = [string stringByReplacingOccurrencesOfString:@"&" withString:@"%26"];

  NSLog(@">>>Just pass this to Whatspp using their URL scheme %@",string);

我测试得很好。 :) 祝你好运。

关于ios - 使用 WhatsApp URL Scheme 发送我的 App URL Scheme,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21448286/

相关文章:

ios - UIScrollView 嵌套在 UIPageViewController 幻灯片中

html - iOS:用于 MFMailCompseViewController 的复杂 HTML/CSS

ios - 从 View 过渡 :toView:duration:options:completion: confusion

ios - 如何用百分比颜色填充 UITableViewCell

asp.net-mvc - MVC 路由 Html.ActionLink 使用 ?id=1 而不是/id 创建 URL

php - 使用签名算法版本 4 创建签名的 S3 下载链接

ios - 响应式网站在 Firefox 响应模式下运行良好,但在 Chrome 或设备中运行不佳

iphone - 执行将应用程序从 sleep 中唤醒的功能

url - 如何从Grails中的URL删除应用程序名称和端口?

iphone - iOS6 自动旋转 - UIPageViewController