iOS9: canOpenURL returning false for WhatApp's url scheme

蹲街弑〆低调 提交于 2019-11-30 18:52:25

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:

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.

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>

Step:1 Add LSApplicationQueriesSchemes in Info.plist

Step:2 Add whatsapp in items

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

and it work only for LSApplicationQueriesSchemes

This will not work

This will work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!