Opening an app based on its URL scheme

suggest change

To open an app with defined URL scheme todolist://:

Objective-C

openURL: still compiles. It was deprecated in iOS 10 in favor of openURL:options:completionHandler:.

NSURL *myURL = [NSURL URLWithString:@"todolist://there/is/something/to/do"];
[[UIApplication sharedApplication] openURL:myURL];

Swift

let stringURL = "todolist://there/is/something/to/do"
if let url = URL(string: stringURL) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

HTML

<a href="todolist://there/is/something/to/do">Open the to-do list</a>

Note: Check whether the link can be opened, and otherwise show an appropriate message. canOpenURL returns false for a custom scheme unless LSApplicationQueriesSchemes lists that scheme.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents