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.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...