简体   繁体   English

ios Whatsapp共享不适用于iPhone 5s

[英]ios Whatsapp Sharing not working for iphone 5s

Here is the code. 这是代码。 I took it from http://www.whatsapp.com/faq/en/iphone/23559013 It goes into if condition. 我从http://www.whatsapp.com/faq/zh-CN/iphone/23559013那里拿来的。 But do nothing. 但是什么都不做。 This code worked for iphone 5. And in case of iphone 5s nothing happened. 该代码适用于iphone5。在iphone 5s的情况下,什么也没有发生。 It is not opening Whatsapp URL. 它没有打开Whatsapp URL。

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
}

In Plist add 在Plist中添加

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>whatsapp</string>
</array>

Maybe is not your case but I think my answer will help someone else. 也许不是您的情况,但我认为我的回答会帮助其他人。

I had the same issue on iOS 11 and the problem was that some customUrls are not supported anymore from UIApplication.shared.canOpenURL() . 我在iOS 11上遇到了同样的问题,问题是UIApplication.shared.canOpenURL()不再支持某些customUrl。

You have to use UIApplication.shared.openUrl() . 您必须使用UIApplication.shared.openUrl()

I hope this can be helpful 我希望这会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM