Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does facebook app link work without declaring LSApplicationQueriesSchemes?

In iOS 9 apps can't use canOpenURL to check if application installed or not.

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.

but I am wondering how facebook app succeed to direct the user to appstore if the application is not installed , or to open target application if it's installed !

facebook can't list all apps in LSApplicationQueriesSchemes !

Thanks

like image 260
david Avatar asked May 20 '16 11:05

david


1 Answers

From 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.

So, they do the following:

1) Try to call openURL: with fb-compliant urls, for example fb[app-id]://authorize... until it returns true (I have checked it, they are calling a lot of urls, for example fb[app-id]lite, fb[app-id]mac, fb[app-id]paid, fb[app-id]green, etc). If it succedes, target app opens.

2) If there is no success with calling openURL:, they try to call canOpenURL: with http://itunes.apple.com/app/... url and then call openURL: with same url. User is redirected to App Store.

like image 197
Roman Ermolov Avatar answered Oct 23 '22 18:10

Roman Ermolov