Instance Method


Returns a Boolean value indicating whether or not the URL’s scheme can be handled by some app installed on the device.


func canOpenURL(_ url: URL) -> Bool



A URL (Universal Resource Locator). At runtime, the system tests the URL’s scheme to determine if there is an installed app that is registered to handle the scheme. More than one app can be registered to handle a scheme.

The URL you pass to this method can have a common scheme or a custom scheme.

Return Value

false if there is no app installed on the device that is registered to handle the URL’s scheme, or if you have not declared the URL’s scheme in your Info.plist file; otherwise, true.

Read the Discussion section for more information on conditions that affect the return value.


When this method returns true, iOS guarantees that subsequent calls to the openURL(_:) method with the same URL will successfully launch an app that can handle that URL. The return value does not indicate the validity of the URL or whether the specified resource exists.

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 openURL(_:) method is not constrained by the LSApplicationQueriesSchemes requirement. That method works if an app is available to open the URL, whether or not you have declared the scheme.

See Also

Opening a URL Resource

class let openSettingsURLString: String

Used to create a URL that you can pass to the openURL(_:) method. When you open the URL built from this string, the system launches the Settings app and displays the app’s custom settings, if it has any.