Returns a Boolean value indicating whether an app is available to handle a URL scheme.
SDKs
- iOS 3.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
Parameters
url
A URL (Universal Resource Locator). At runtime, the system determines if an installed app is registered to handle the URL's scheme. More than one app can be registered to handle a scheme.
The URL can have a common scheme such as
http
,https
,tel
, orfacetime
, or a custom scheme. For information about supported schemes, see Apple URL Scheme Reference.
Return Value
false
if no app installed on the device is registered to handle the URL’s scheme, or if you have not declared the URL’s scheme in your Info
file; otherwise, true
.
Discussion
When this method returns true
, iOS guarantees subsequent calls to the open(_:
method with the same URL will successfully launch an app that can handle the URL. The return value does not indicate the validity of the URL, whether the specified resource exists, or, in the case of a universal link, whether an installed app is registered to respond to the universal link.
Important
If your app is linked on or after iOS 9.0, you must declare the URL schemes you pass to this method by adding the LSApplication
key to your app's Info
file. This method always returns false
for undeclared schemes, whether or not an appropriate app is installed. To learn more about the key, see LSApplicationQueriesSchemes.
If your app is linked against an earlier version of iOS but is running in iOS 9.0 or later, you can call this method up to 50 times. After reaching that limit, subsequent calls always return false
. If the user reinstalls or upgrades the app, iOS resets the limit.
Unlike this method, the open(_:
method is not constrained by the LSApplication
requirement. If an app is available to handle the URL, the system will launch it, whether or not you have declared the scheme.
Using universal links instead of custom URL schemes removes the need to use this method to validate target links; if no app is available to handle a universal link, iOS routes it to Safari, allowing the associated website to respond. For more information on universal links, see Allowing Apps and Websites to Link to Your Content.