1

Here is the code. I took it from http://www.whatsapp.com/faq/en/iphone/23559013 It goes into if condition. But do nothing. This code worked for iphone 5. And in case of iphone 5s nothing happened. It is not opening Whatsapp URL.

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

2 Answers2

1

In Plist add

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>whatsapp</string>
</array>
kanstraktar
  • 5,357
  • 2
  • 21
  • 29
Raja Jimsen
  • 230
  • 3
  • 5
0

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().

You have to use UIApplication.shared.openUrl().

I hope this can be helpful

Alain
  • 105
  • 7