Bilal Qayyum
Bilal Qayyum

Reputation: 11

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. 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];
}

Upvotes: 1

Views: 427

Answers (2)

Alain
Alain

Reputation: 105

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

Upvotes: 0

Raja Jimsen
Raja Jimsen

Reputation: 230

In Plist add

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

Upvotes: 1

Related Questions