Reputation: 1333
I know that once I have whitelisted URLs in my plist file, I can programmatically determine if that app is installed on my device. For example, if I have the spotify
string in my LSApplicationQueriesSchemes
array in the plist file, I can then query via
UIApplication.shared.canOpenURL(NSURL(string: "spotify")! as URL)
My question here is - does the target app have to explicitly whitelist their URL too? So that others can use it? Or does this work with every app? Does every app implicitly have such a URL?
Upvotes: 0
Views: 1540
Reputation: 318794
In order for an app to be opened via openURL
, the app must register its support for one or more custom URL schemes. So no, not every app implicitly has a custom URL scheme.
When a user installs an app, iOS keeps track of which URL schemes the installed apps support.
When some app calls canOpenURL
, iOS first verifies that the calling app has whitelisted that custom scheme. If so, it then checks to see if any installed app on the device has registered that custom URL scheme and returns true
or false
accordingly.
Upvotes: 1