ios – Facebook应用程序如何链接工作,而不声明LSApplicationQueriesSchemes?

在iOS 9应用程序不能使用canOpenURL来检查是否安装了应用程序.

If your (iOS 9.0 or later) app calls this method using a scheme you
have not declared,the method returns false,whether or not an
appropriate app for the scheme is installed on the device.

但是我想知道如果没有安装应用程序,或者如果安装了应用程序,Facebook应用程序如何成功地将用户指向应用程序?

Facebook无法列出LSApplicationQueriesSchemes中的所有应用程序!

谢谢

解决方法

来自canOpenURL: documentation:

Unlike this method,the openURL: method is not constrained by the
UIDefaultLaunchStoryboard requirement: If an app that handles a scheme
is installed on the device,the openURL: method works,whether or
not you have declared the scheme.

所以他们做如下:

1)尝试调用openURL:使用fb兼容的URL,例如fb [app-id]://授权…直到它返回true(我已经检查过,他们调用了很多url,例如fb [ app-id] lite,fb [app-id] mac,fb [app-id] paid,fb [app-id] green等).如果成功,目标应用程序将打开.

2)如果呼叫openURL没有成功,他们尝试调用canOpenURL:http://itunes.apple.com/app / … url,然后调用openURL:具有相同的URL.用户被重定向到App Store.

以上是来客网为你收集整理的ios – Facebook应用程序如何链接工作,而不声明LSApplicationQueriesSchemes?全部内容,希望文章能够帮你解决ios – Facebook应用程序如何链接工作,而不声明LSApplicationQueriesSchemes?所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。