NSURL is a class that holds a URL.
Pre-registered URL scheme
There are a bunch of URL schemes reserved within iOS. You cannot register these schemes in your app.
Scheme | Form | Handler | Public | Usage |
---|---|---|---|---|
ftp | - | MobileSafari | Yes | File transfer protocol. |
http | - | MobileSafari | Yes | Hypertext transfer protocol. |
https | - | MobileSafari | Yes | HTTP Secure. |
feed | [1] | MobileSafari | Yes | Web Feed. |
feeds | - | MobileSafari | Yes | Web Feed? |
calshow | calshow:x?eventid=id | MobileCal | No | Used in -[SBCalendarAlertItem revealEvent]. |
calinvite | calinvite:eventid=id | MobileCal | No | Used in -[SBInvitationAlertItem revealEvent]. |
calinvitelist | ? | MobileCal | No | ? |
mailto | [2] [Archived 2009-12-16 at the Wayback Machine] | MobileMail | Yes | Sending emails. |
sms | sms:phoneNumber | MobileSMS | Yes | Sending SMS. |
tel | tel:phoneNumber | MobilePhone | Yes | Telephone. |
telprompt | telprompt:phoneNumber | MobilePhone | Yes | Telephone with prompt. Available only in 3.0 –. |
callto | ? | MobilePhone | No | ? |
telshow | telshow:// | MobilePhone | No | ? |
tellock | tellock:// | MobilePhone | No | ? |
telanswer | telanswer:something/ | MobilePhone | No | Used in -[SBCallAlertDisplay answer:]. |
telemergency | telemergency:// | MobilePhone | No | ? |
vmshow | vmshow:integer | MobilePhone | No | Voicemail. Used in -[SBVoiceMailAlertItem performUnlockAction]. |
maps | maps:params | Maps | Yes | Maps. URLs of this type can be interpreted as http://maps.google.com/maps?params. |
prefs | prefs:params | Preferences | No | Preferences. params can be like root=General&path=About. |
youtube | youtube:videoID | YouTube | Yes | YouTube video. URLs of this type can be interpreted as http://www.youtube.com/v/videoID. |
itms | - | MobileStore | Yes | iTunes Music Store. |
itmss | - | MobileStore | Yes | ? |
itms-apps | - | AppStore | Yes | ? |
itms-appss | - | AppStore | Yes | ? |
webcal | [3] | SpringBoard | Yes | WebCal subscription. |
doubletap | doubletap://displayID | SpringBoard | No | The application will be launched when user double tapped the home button. |
search | search://displayID/domain/identifier | SpringBoard | No | ? |
rdar | rdar:url | MobileSafari | Yes | Radars (bug reporter). URLs of this type can be interpreted as https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/wa/openURL?url=url. |
radar | radar:url | MobileSafari | Yes | Radars (bug reporter). Equivalent to rdar:. |
javascript | - | MobileSafari | No | Execute Javascript. Can only be used in MobileSafari. |
ff | ff:param or maps:param | FriendFinderApp | ? | Friend finder URL. Not usable yet. |
springboard | springboard:/command | SpringBoard | No | SpringBoard command. Seems abandoned. Only referred in -[UIApplication _runSpringboardCommand:]. |
webclip | ? | MobileSafari | No | ? |
audio-player-event | ? | MobileMusicPlayer | No | ? |
video-player-event | ? | MobileMusicPlayer | No | ? |
photos-event | ? | MobileSlideShow | ? |
In addition, common Jailbroken devices also have cydia and apptapp scheme reserved for Cydia.
Friend Finder URLs
Friend finder URLs are handled by the unknown application "com.apple.FriendFinderApp". It may be similar in function to Google Latitude[1].
There are 4 kinds of friend finder URLs:
- "ff/acc" URLs: These are of the form ff:t=token. These URLs will be transformed to https://iphone-services.apple.com/ff/acc?t=token&bid=0. There are also maps:t=token which the only difference is bid=1.
- "ff/su" URLs: These are of the form ff:em=email. These URLs will be transformed to https://iphone-services.apple.com/ff/su?em=email.
- Friend-to-friend URLs: These are of the form maps:ffsourceuserid=sourceFriend&ffdestuserid=destFriend.
- Friend URLs: These are of the form maps:ffuserid=friend.
Launching Private URL schemes
Private URLs can be launched using -[LSApplicationWorkspace openSensitiveURL:withOptions:], which is in the MobileCoreServices framework. (On iOS 7 this method seems to cause a delay) For example the following will open the Preferences app to the Brightness & Wallpaper section:
[[LSApplicationWorkspace defaultWorkspace] openSensitiveURL:[NSURL URLWithString:@"prefs:root=Wallpaper"] withOptions:nil]
- Note: Private URL schemes will only be opened with the "sensitive" method. The method returns YES on success.
Alternatively from the SpringBoard you can use the method -[SpringBoard applicationOpenURL:] e.g:
[[SpringBoard sharedApplication] applicationOpenURL:[NSURL URLWithString:@"prefs:root=Wallpaper"]]
References
- ^ iPhone URL Schemes – Including Google Latitude: http://www.dc-studios.net/blog/?p=148
- Official reference: NSURL
- Apple URL Scheme Reference: http://developer.apple.com/safari/library/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html [Archived 2010-01-31 at the Wayback Machine]
- UIKit additions: http://github.com/kennytm/iphone-private-frameworks/blob/master/UIKit/NSURL.h
- Repository of URL schemes registered by AppStore apps: http://handleopenurl.com/ [Archived 2011-02-04 at the Wayback Machine]