iOS9: canOpenURL returning false for WhatApp's url scheme

In my current project I need to share text on whatsapp from iOS app.

Here is my code to share text on whatsapp:-

  • How can whatsapp know country code upon first run on iphone
  • Sharing image to Whatsapp & Facebook
  • Share link using whatsapp
  • iOS - Share image + text to WhatsApp?
  • Open WhatsApp conversation using Abid doesn't work
  • How i get WhatsApp abid to compose a message to a specific user in iOS?
  • NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%2C%20World!"];
    if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
    }
    

    but canOpenURL always returning false in iOS9.

    Is there any iOS9 privacy policy ?
    Can anyone help me out.

    Thanks in advance.

    4 Solutions Collect From Internet About “iOS9: canOpenURL returning false for WhatApp's url scheme”

    In iOS 9 you must whitelist any URL schemes your App wants to query in Info.plist under the LSApplicationQueriesSchemes key (an array of strings):

    For example:

    enter image description here

    So in your case, instead of fb and twitter you will have to specify whatsapp.

    Note that this mechanism only applies to canOpenURL and not openURL. You do not need to have a scheme listed in Info.plist to be able to open it with openURL.
    Hope that helps.

    Step:1 Add LSApplicationQueriesSchemes in Info.plist

    Step:2 Add whatsapp in items

    In addition to @z22’s answer if you need to add it textually (e.g. with Xamarin) then it looks like this:

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

    For me the issue was because I was using URL types instead of LSApplicationQueriesSchemes

    and it work only for LSApplicationQueriesSchemes

    This will not work

    URL types

    This will work

    LSApplicationQueriesSchemes