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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With