也许我在这里遗漏了一些简单的东西,但我终生无法让我的 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/