Launching iPhone Apps With Custom URL Scheme – Part 1

In an earlier post I talked about how to launch the browser from within an iPhone application using the UIApplication:openURL: method.

It is also possible to use this same technique to launch other applications on the iPhone that are very useful.

Examples of some of the key applications that you can launch via URL are:

  • Launch the Browser (see earlier post )
  • Launch Google Maps
  • Launch Apple Mail
  • Dial a Phone Number
  • Launch the SMS Application
  • Launch the Browser
  • Launch the AppStore

Launch Google Maps

The URL string for launching Google Maps with a particular keyword follows this structure:${QUERY_STRING}

The only trick to this is to ensure that the value for the ${QUERY_STRING} is properly URL encoded. Here is a quick example of how you would launch Google Maps for a specific address:

// Create your query ...
NSString* searchQuery = @"1 Infinite Loop, Cupertino, CA 95014";
// Be careful to always URL encode things like spaces and other symbols that aren't URL friendly
searchQuery =  [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
// Now create the URL string ...
NSString* urlString = [NSString stringWithFormat:@"", searchQuery];
// An the final magic ... openURL!
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
Launch Apple Mail

Also very useful, is the ability to enable a user to quickly send an email by launching the email client in compose mode and the address already filled out. The format of this URI should be familiar to anyone that has done any work with HTML and looks like this:


For example, here we are opening the email application and filling the “to:” address with :

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://"]];
Dial a Phone Number (iPhone Only)

You can use openURL: to dial a phone number. One advantage this has over other URLs that launch applications, is that the dialer will return control back to the application when the user hits the “End Call” button.

Anyone familiar with J2ME or WML will find this URL scheme familiar:


Here is an example of how we would dial the number (800) 867-5309:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];

NOTE When providing an international number you will need to include the country code.

Launch the SMS Application

Also not supported by the iPod Touch, is the ability to quickly setup the SMS client so that your users can quickly send a text message. It is also possible to provide the body of the text message.

The format looks like this:


NOTE: Unlike other URLs, an SMS url doesn’t use the “//” syntax. If you add these it will assume it is part of the phone number which is not.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:55555"]];

NOTE: According to the official SMS specification, you should be able to send a body as well as the phone number by including “?body=” parameter on the end of the URL … unfortunately Apple doesn’t seem to support this standard.

Launching the AppStore

Finally, it is worth noting that you can launch the AppStore and have the "buy" page of a specific application appear. To do this, there is no special URL scheme. All you need to do is open up iTunes to the application you want to launch; right-click on the application icon at the top left of the page; and select Copy iTunes Store URL .

The URL will look something like this:

Launching the AppStore URL is exactly the same as you would launch the browser. Using the link above, here is an example of how we would launch the AppStore:

NSURL *appStoreUrl = [NSURL URLWithString:@""];
[[UIApplication sharedApplication] openURL:appStoreUrl];


  1. URL schemes are great, but one important piece of information that you didn’t mention is that openURL: returns a boolean that can be used to determine whether the device is able to handle the URL.

    For example if you do tel: or sms: on an iPod touch it will return NO and you can display an error message.

    This becomes critical when you use URL schemes for applications you can download from the AppStore. My app, for example, allows you to add bookmarks to Delicious, but obviously the ‘yummy:’ URL scheme won’t work if it’s not installed!

  2. What about launching some other 3rd party application. Or starting some other process from one process?

  3. @Stephen that is a great point. Thanks for the comment.

    @Raj it is possible to invoke a 3rd party application ONLY if said application has taken the necessary steps to register the URL scheme with the phone. I’ll try to dig up an example to illustrate how this is done.

    The URL scheme is the text before the “://” in the URL so if you wanted to create a scheme “foo” a URL would look like “foo://….”. You should even be able to pass parameters in the URL. I’ve not tried to do this yet, but as soon as I find out how I’ll post back here.

    – Rodney

  4. @Stephen:
    Is that correct? It may be true for tel: and sms: URL schemes, but I don’t think it applies to custom URL schemes.

    In my testing openUrl: always returns YES, even when called with an unsupported URL scheme. I can’t find a way to prevent the OS from displaying its own “Unsupported URL” alert message, nor a way to query for supported URL schemes.

  5. Darren, yes it does work even for custom URL schemes. The iPhone sometimes gets confused if you install and remove applications with URL schemes:

    Maybe that’s what you’re seeing?

    And no, there’s no (documented) way of discovering whether a URL scheme is supported. The way I do it try it and if it fails then disable the option next time. It’s imperfect but as far as I know the best you can do at the moment.

  6. Does anyone know how to launch a custom application from an email or sms?


  7. @David Heacock

    The process of launching an application is as simple as including a URL in the email or sms message. Follow the steps in this article to register your application to respond to a particular URL and then just put that URL in your message.

    NOTE: There is currently no push support so the user will still need to click the URL for it to actually open the application.

  8. Anyway to launch the iPod app to start playing a certain song?

  9. I’ve seen that Apple’s own iPhone apps can send an email from a special mailer view that comes and goes, within the app– similar to how we are allowed to pick and even add/edit Contacts from within our apps.

    Does anyone know if this “SendMail” API has been made available to us in the SDK?

  10. @Scenario: nope, the “SendMail” API is not available unless you’re Apple. The only option is to use the mailto: URL scheme. Or include your own SMTP client.

    Also, I found that I now see what @Darren is getting. This certainly worked in iPhone OS 2.0. Looks like something broke.

  11. Thanks guys, now how do you launch iphone’s built-in address book?

    Generally code samples talk about creating own interface into the address database (e.g. using AddressBookUI), but say you want your app to just launch iphone’s “Contacts” app? Thx. Gabe.

  12. Hi,
    I have an app in which I need to play a video. Can you tell me if there is a way I can do it without using YouTube? Does QT player support being invoked using URL? Also, once the video is completed, I would like my application to be restored? Is it possible?

    Appreciate any pointers on this.


  13. Hi,
    I want to open the calendar application from my custom application. What URL i can use for that.?

  14. Hi
    i am trying openURL for mailto functionality but no success (in simulator) using 2.2.1. can any body tell where is problem
    Also i want to enter date from my app into iphone calender, any body have any idea?


  15. @kanayl

    The simulator does not come loaded with the email application that is why you can’t use the mailto functionality in the simulator.

    As for the calendar, there is not currently a way to do this.

  16. I am trying openurl for call option, Once the call ended it returns back to my application (restarting the application). Can anyone help me , i want to return back to the same place where i clicked to call.


  17. Hi,

    I’m want to open an app if it’s also installed on the device, and notify the user otherwise, but the app hangs on the openurl line of code, so never beeps? Any ideas how I can work around this anyone?

    BOOL win = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

    if( win == 0 ) { void NSBeep(); };

  18. Thats great info thanks.
    Just one beginners question. How do you go back to your app once you open the google maps.


  19. @Bruce: Raji asked the same question. The answer has not changed since then (i.e., you can’t).

    Some other information has changed. In 3.0 it is now possible to detect which URL schemes are available and there is also the mail sheet API that Scenario was looking for.

  20. Hi
    i am trying to dial phone no from app but there is no effect against phone no. i am using
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel://8004664411″]];

    where is the problem? thanks in advance.

  21. Hi,
    Is there any way (documented or not…) to open *not* with the default Inbox view loaded rather than the compose view?

  22. What if I just want to query which other apps are installed on the iPhone? I know when the newest update Apple can recommend apps based on current installations. Is there any way to do this with public API? Thanks in advance.

  23. Steven,

    You can take photos directly with the iPhone SDK without launching the Camera application, which allows you to stay within the application you are running. Or is there something specific within the camera application you are interested in?


  24. Hi, John,
    Thanks for responding. Actually, I have already programmed the camera in to the app, but I’m thinking of taking it out, because when the camera launches and a photo is taken, it adds 16.5 Meg to the “Real Memory” used by the app (according to Instruments) and I occasionally get a memory warning. I don’t want the app to crash when Apple reviews it! Instead, I might have the user launch his Camera app, take the pictures, then return to my app to select them from his camera roll and attach them to an email within my app. That takes much less memory.

    There was a posting on Apple’s developer forum about using malloc to grab the memory you need for the camera, and not launch Camera if the memory is unavailable. Sounds intruiging, but it also sounds like adding too many complications. Do you have trouble with using Camera in apps because of memory considerations?


  25. Hello!

    Can I also open the SMS Application without specifing a number or anything? Just simply quit my app and start the SMS-App.
    I want the user to stay in a conversation, if it is the case, select the contact(s) to send the text to within the SMS-Application itself. So could I do it like this:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”sms:”]];

    I read somewhere that you may be banned from the AppStore, if you use “sms:” in your application. Is this true?

  26. Hi Steve,

    Interesting question on the memory front and the camera. I didn’t experience any memory problems in using the camera in my applications, however, could have to do with what else is loaded in the application at the same time (or not loaded for that matter)

    Are there other areas in your application where you tinker with how memory is managed. For example, in one application I was pushing the limits on memory and was able to save significant memory by not caching images as I wrote about here:

    Let me know what you discover if you look into how memory used in your app.


  27. Hi Guys,

    Can you us this process to open the “Calendar” app, the “iPhones Voicemail” page & the “mail accounts” screen?

    Thank you very much.

  28. Dialing a number in os 3.1 form our app has one issue .
    Dialer doesn’t return control back to the application when the user hits the “End Call” button. Any one who can fixed this issue.

  29. Hi guys,

    I want to know whether it is possible to launch the SMS application via OpenUrl Scheme with the preloaded message in 3.1.

  30. Hi Gurus
    i am working on iphone live tv app. i have a streaming link that will stream video and audio. but i don’t know how to launch video player in iPhone native app. any body have some idea or any help, how i can that. thanks in advance

  31. I tried to open the app store like you suggested:

    NSURL *appStoreUrl = [NSURL URLWithString:@”″];

    [[UIApplication sharedApplication] openURL:appStoreUrl];

    But I get an error from Safari saying “Safari can’t open page because too many redirects occurred”.
    Any idea why?

    • roei: the simulator will not open URL’s to the iTunes store, however the code will work on device.

  32. Seen a few related / unanswered queries above… Does anyone know if there is a URL Scheme Reference for the iPhone iPod app? We’d like our site to redirect content to a (pref Apple) media app that handles M3U and PLS files from HTML anchor tag. Several blogs say M3U is supported on iPhone v3.x but I’m not seeing how that happens.

  33. Will this approach work with ADHOC distributions or only distributions through the app store?


  34. Hi,
    I am trying to open another application present on appstore from my iphone application,by using ur above given code but safari showing an alert “LOTS OF REDIRECTION,NOT ABLE TO OPEN”

    Tell me onething is it possible that from our application we are able to delete or uninstall other application present in our iphone.

    • It sounds like you may be trying this on the simulator?? If so, try the application on a device and see if you have the same problem.

  35. I have the two applications (MyApp1 that will launch MyApp2), and MyApp2, both installed and running on the device using ADHOC profiles. The code event cycle is working, because if I change from @”myapp2://” to @”http://foo” (in MyApp1) and select the item while running a Safari web page to foo is launched. But returning to @”myapp2://” does nothing. I wish that I could trace the behavior and find out what is going on. It seems clear that there is no knowledge of the url scheme for myapp2 available to MyApp1. In fact, I am not sure how MyApp1 would know about any url schemes. It seems like they have to be registered outside of the device to work and that is why I asked about the ADDHOC vs. APP STORE installation.


    • I am having the same issue ( defining a URL scheme with ADHOC distribution does not work ). Did you find a solution for this problem? Thanks.

  36. Is there a way to send a predefined message instantly to another phone?

    Maybe send a predifined sms or something simular?

  37. How can I launch an iPhone application from another iPhone application.

  38. Thank you very much. I used your code for sending my application. But I got troubled. When I am sending sms, I am not redirecting to my application, in stead of that I was put in sms application of iphone. So please help me redirecting to my application after sending sms.

  39. When an app places a call using the iPhone4 dialler, can anyone suggest a way to return to the app AS SOON as the call has connected (not ended)?

    Thanks, Peter

  40. Can any one tell me how to open “Apple Store” app from iPhone app!!
    Thanks, GRD.

    • Were you able to open the “Apple Store” app? Also, do you know how to go to a particular product?

  41. Hi Rodney,

    i’m from Brazil, and don’t speak English, but I read this article and like to ask you if it’s possible open the phone app and play some keyboard tones, like those who need to be tapped to acces voice mail.

  42. Great article and comments! Is there any way to launch the that first opens the inbox (not the email composer)?

  43. Hello,
    This is a great article. I have one question, is it possible to launch the other app in background?
    In other words, from my app, I click a button and it launches an other app but is running in the background so my application remains on top.

  44. hi
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”tel://*100#”]];
    doesn’t work
    that it is possible to make

  45. Is it possible to launch an app that you have (not in App Store)?


    • If you are referring to launching an app on your device that was not downloaded from the app store? Sure, if the app is loaded and has a custom URL scheme defined, you can load/launch the app.

      • Ok, Thanks, Im Using GameSalad, Now I cant create the Custom URL :(

        You know if there is a way to Use Open Url to send some information to my site, without leaving the App?

  46. Hi there, will this work to launch an app using a “Web Clip” on the Home Page of an iPad?

    What I want to do is put an app icon on my users’ iPad that launches a PDF file that is located at a certain spot in a WebDAV folder (no authentication required) on the internet directly in an App that has a custom URL scheme defined…

    In Safari you can “Add To Home Page” and add a link onto the Home Page, so the idea would be to have an ibooks:// link rather than an http:// and it would open the pdf being linked to there within iBooks

  47. Read that “One advantage this has over other URLs that launch applications, is that the dialer will return control back to the application when the user hits the “End Call” button.”

    IS this true ? I am not able to achieve this :(

  48. I actually hvae the opposite question for google maps. Is there anyway to force google maps to stay in a browser on an ipad. I have ios5 and want links in my website to stay in the safari browser and not open the ipad app. This worked fine on ios4 but on ios5 everything goes to the app. Any thoughts?

  49. How can i return to my original app? I don’t know. help me.
    URL Scheme works fine but how can i return to my main app?
    help me

    • Ashok, the only way I know of to return to your app would be if your app has a URL scheme that can be called from the other app.

  50. Can I use my code to ask the system to open a file, thus launching another app to handle the file open?
    So I could open a PDF from my App and what ever PDF viewer is installed on the iphone/IPAD would load opening it.


  51. If I open Email app using URL scheme, how can I return to my app after sending an email through Email app?

  52. Can you launch an application from an application that is running in the background?

    For example you can a background app collecting gps data, when it reaches a certain location you either send the app to the foreground or open another application automatically, is this possible?


  53. The better way maybe is use bellow code:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”itms-apps://”]];

    and directly appstore app will open on your idevice.

Comments are closed.