Handling URL Schemes
// canOpenURL method verifies if there is any app which can handle indicated URL scheme.
UIApplication.sharedApplication().canOpenURL(_ aUrl: NSURL)
[[UIApplication sharedApplication] canOpenURL:(NSURL *)aUrl];
// openURL method tries to open a resource located by URL. YES/true if it was opened otherwise NO/false.
UIApplication.sharedApplication().openURL(_ aUrl: NSURL)
[[UIApplication sharedApplication] openURL:(NSURL *)aUrl];
|aUrl||a NSURL instance which stores a built-in or custom scheme string|
In iOS9 and above your app must list any URL schemes it will want to query. This is done by adding
LSApplicationQueriesSchemes to Info.plist
iOS has built-in support for the
facetime schemes. It also supports http–based URLs for
Examples of built-in URL schemes:
Note: Not all special characters are supported in
tel scheme (for example
#). This is done because of security concerns to prevent users from unauthorized redirect of calls, so in this case
Phone app won't be opened.
Apple URL Schemes
These are URL schemes supported by native apps on iOS, OS X, and watchOS 2 and later.
Opening link in Safari:
Starting a phone conversation
Starting a FaceTime conversation
Opening Messages App to compose an sms to recipient:
Opening Mail app to compose an email to recipient:
You can also include a subject field, a message, and multiple recipients in the To, Cc, and Bcc fields. (In iOS, the from attribute is ignored.) The following example shows a mailto URL that includes several different attributes:
Note: Compose email dialog can also be presented within app using