Contents

openURL(_:)

Attempts to open the resource at the specified URL.

Declaration

func openURL(_ url: URL) -> Bool

Parameters

  • url:

    A URL (Universal Resource Locator). UIKit supports many common schemes, including the http, https, tel, facetime, and mailto schemes. You can also employ custom URL schemes associated with apps installed on the device.

Return Value

true if the resource located by the URL was successfully opened; otherwise false.

Discussion

The URL you pass to this method can identify a resource in the app that calls the method, or a resource to be handled by another app. If the resource is to be handled another app, invoking this method might cause the calling app to quit so the other can launch.

To check if there is an installed app that can handle a scheme, call the canOpenURL(_:) method before calling this one. Be sure to read the description of that method for an important note about registering the schemes you want to employ.

See Also

Related Documentation

Deprecated methods