problem using tel: URL to initiate a callHow to use tel: with * (star, asterisk) or # (hash, pound) on iOS?adding uibutton to a detail view programmaticallyHow to debug a function(that can only work on a real device) with different SDK version?openUrl in landscape mode in iphoneCan I display a driving track between two points using the map kit?Can Iphone restore the state of app after [[UIApplication sharedApplication] openURL:[NSURL URLWithString:call_url]];Launching the iPhone maps application from your own codeiOS How to exit current app after using UIApplication openURL to launch a browserOpen map url in iPhone simulator always redirectshow to close the hyperlink window?Access the Apps available in iphoneWhere exactly to place “…[UIApplication sharedApplication] openURL…”?Open Url hosted using POST method in Safari using sharedApplication openURL method

Why do legislative committees exist?

What do mathematicians mean when they say some conjecture can’t be proven using the current technology?

What to look for in climbing shoes?

Why are road bikes (not time trial bikes) used in many triathlons?

Can a Resident Assistant Be Told to Ignore a Lawful Order?

Was Willow's first magic display (blazing arrow through arm) actual magic, and if not, what's the trick?

Is 7000 words too long for a chapter?

If I stood next to a piece of metal heated to a million degrees, but in a perfect vacuum, would I feel hot?

How to honestly answer questions from a girlfriend like "How did you find this place" without giving the impression I'm always talking about my exes?

What impact would a dragon the size of Asia have on the environment?

Why isn't aluminium involved in biological processes?

In Adventurers League, is there any way for an 5th-level wizard to gain heavy armor proficiency?

Ethical for a company to ask employees to move furniture on the weekend?

What are some symbols representing peasants/oppressed persons fighting back?

What's the meaning of こそ in this sentence?

Is dividends exclusively a part of earnings?

Why hasn't the U.S. government paid war reparations to any country it attacked?

Why is "dark" an adverb in this sentence?

Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"

FPGA CPU's, how to find the max speed?

Why did Steve Rogers choose Sam in Endgame?

Is this more than a packing puzzle?

Why doesn't philosophy have higher standards for its arguments?

Confusion about a proof of a limit formula



problem using tel: URL to initiate a call


How to use tel: with * (star, asterisk) or # (hash, pound) on iOS?adding uibutton to a detail view programmaticallyHow to debug a function(that can only work on a real device) with different SDK version?openUrl in landscape mode in iphoneCan I display a driving track between two points using the map kit?Can Iphone restore the state of app after [[UIApplication sharedApplication] openURL:[NSURL URLWithString:call_url]];Launching the iPhone maps application from your own codeiOS How to exit current app after using UIApplication openURL to launch a browserOpen map url in iPhone simulator always redirectshow to close the hyperlink window?Access the Apps available in iphoneWhere exactly to place “…[UIApplication sharedApplication] openURL…”?Open Url hosted using POST method in Safari using sharedApplication openURL method






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








26















I'm trying to initiate a call from within an iPhone app.



This related code works and opens Safari as expected:



[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];


But, when I replace the http URL with a tel URL the resulting code does not invoke the phone app:



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


No exceptions or alerts are generated (in the simulator or on a device).



Any idea what the problem might be with my invocation?



Thanks.










share|improve this question

















  • 1





    it should work, maybe there is something prior in the code. what is the device ? an ipod touch can't phone ...

    – CiNN
    May 1 '09 at 17:10











  • It's an iPhone.

    – denton
    May 1 '09 at 17:13

















26















I'm trying to initiate a call from within an iPhone app.



This related code works and opens Safari as expected:



[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];


But, when I replace the http URL with a tel URL the resulting code does not invoke the phone app:



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


No exceptions or alerts are generated (in the simulator or on a device).



Any idea what the problem might be with my invocation?



Thanks.










share|improve this question

















  • 1





    it should work, maybe there is something prior in the code. what is the device ? an ipod touch can't phone ...

    – CiNN
    May 1 '09 at 17:10











  • It's an iPhone.

    – denton
    May 1 '09 at 17:13













26












26








26


8






I'm trying to initiate a call from within an iPhone app.



This related code works and opens Safari as expected:



[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];


But, when I replace the http URL with a tel URL the resulting code does not invoke the phone app:



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


No exceptions or alerts are generated (in the simulator or on a device).



Any idea what the problem might be with my invocation?



Thanks.










share|improve this question














I'm trying to initiate a call from within an iPhone app.



This related code works and opens Safari as expected:



[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];


But, when I replace the http URL with a tel URL the resulting code does not invoke the phone app:



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


No exceptions or alerts are generated (in the simulator or on a device).



Any idea what the problem might be with my invocation?



Thanks.







iphone






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 1 '09 at 17:00









dentondenton

2781 gold badge5 silver badges8 bronze badges




2781 gold badge5 silver badges8 bronze badges







  • 1





    it should work, maybe there is something prior in the code. what is the device ? an ipod touch can't phone ...

    – CiNN
    May 1 '09 at 17:10











  • It's an iPhone.

    – denton
    May 1 '09 at 17:13












  • 1





    it should work, maybe there is something prior in the code. what is the device ? an ipod touch can't phone ...

    – CiNN
    May 1 '09 at 17:10











  • It's an iPhone.

    – denton
    May 1 '09 at 17:13







1




1





it should work, maybe there is something prior in the code. what is the device ? an ipod touch can't phone ...

– CiNN
May 1 '09 at 17:10





it should work, maybe there is something prior in the code. what is the device ? an ipod touch can't phone ...

– CiNN
May 1 '09 at 17:10













It's an iPhone.

– denton
May 1 '09 at 17:13





It's an iPhone.

– denton
May 1 '09 at 17:13












11 Answers
11






active

oldest

votes


















43














The iphone will dial a number using either of the formats listed below. But, it will do nothing if you are in the simulator. It took me 30 minutes of banging my head to figure this out.



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

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

[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:@"tel:1-541-555-1234"]];


Link for Apple documentation on the tel: url scheme



Link for openURL documentation






share|improve this answer




















  • 2





    The 1st format does not work on the device.

    – joshis
    Jun 29 '12 at 14:47


















7














As @bentford said one might get miscarried because the simulator does show an alert when you try to click on a phone on the contacts app, this is just an alert that gets generated because the app checks whether or not the tel: protocol is supported on the device or not.



Adding to what he writes you might want to also add support to escape any special characters or spaces as in:



NSString *phoneStr = [NSString stringWithFormat:@"tel:%@",[self.contactDetails objectForKey:@"phone"]];
NSString *escaped = [phoneStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];


Hope it helps.



Cheers.






share|improve this answer
































    6














    (and )are actually no problem if you use stringByAddingPercentEscapesUsingEncoding as suggested by samiq. Same goes for +, / and spaces. It's a URL, so escaping seems natural.



    If I'm guessing right, Apple's regular phone number recognition will be used in the tel: scheme handler, if you escape correctly.



    (missing reputation to make it a comment)






    share|improve this answer






























      4














      If your phone number has ( or ) in it, the Phone app will not launch.






      share|improve this answer























      • FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

        – Gabriel Osorio
        Jul 30 '14 at 19:22


















      3














      Haven't had any problems with it using tel:phone-number and invoking it the same way you are. Only works on the iPhone device, though.



      One thing I did have to do was strip out extraneous characters (like all parentheses, spaces, dashes and dots) out of the phone string. Some of the examples above (but not the original post) have dashes. That might be the problem.






      share|improve this answer























      • Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

        – bentford
        Oct 27 '09 at 5:24


















      3














      I found that the issue was due to characters that where not allowed for tel:// URI - the following code solved my problem:



      NSMutableCharacterSet *charSet = [NSMutableCharacterSet new];
      [charSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
      [charSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
      [charSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];
      NSArray *arrayWithNumbers = [str componentsSeparatedByCharactersInSet:charSet];
      NSString *numberStr = [arrayWithNumbers componentsJoinedByString:@""];





      share|improve this answer


















      • 2





        This code will also remove "+" character from the international country codes.

        – Shmidt
        Dec 5 '13 at 10:32











      • I prefer this answer for filtering questionable "phone number" strings. Thanks!

        – quickthyme
        Feb 2 '16 at 1:19


















      2














      I just ran into this when trying to add a "Call" button to a UIAlertView. I had the following code to handle the call:



      - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

      if (buttonIndex != 0)

      [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-602-555-1212"]];




      It wouldn't open anything, just like you. I even tried a regular http URL. It turned out I had forgotten to set the delegate to self. That's probably your problem also.






      share|improve this answer






























        1














        some additional info about making phone calls via url scheme (as I think someone may find it useful)



        How to use tel: with * (star, asterisk) or # (hash, pound) on iOs?






        share|improve this answer
































          1














          I got the same problem and at last I found the reason was that there was a space in the phone number (for better formatting). After removing the space it worked fine.






          share|improve this answer
































            0














            Here is an update on how to derive a phone number in 2018 (where iOS 11 and 12 are most common):



            NSString *phoneNumberURLString = [@"tel://" stringByAppendingString:[result.phoneNumber
            stringByAddingPercentEncodingWithAllowedCharacters:
            [NSCharacterSet URLPathAllowedCharacterSet]]];
            NSURL *phoneNumberURL = [NSURL URLWithString:phoneNumberURLString];


            samiq's answer was what I used initially until I found that my app would crash due to a nil NSURL being created (and later being passed into a collection object) due to failing to properly escape a phone number formatted like so: (###) ###-####. The aforementioned code resolves this.






            share|improve this answer






























              -3














              The URL should be tel://3035551212 and not tel:3035551212...
              Add that // and it should work.






              share|improve this answer























              • I tried that earlier without success. Thanks.

                – denton
                May 1 '09 at 18:11






              • 1





                Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                – bbrown
                May 13 '09 at 2:22













              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f812243%2fproblem-using-tel-url-to-initiate-a-call%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              11 Answers
              11






              active

              oldest

              votes








              11 Answers
              11






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              43














              The iphone will dial a number using either of the formats listed below. But, it will do nothing if you are in the simulator. It took me 30 minutes of banging my head to figure this out.



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

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

              [[UIApplication sharedApplication]
              openURL:[NSURL URLWithString:@"tel:1-541-555-1234"]];


              Link for Apple documentation on the tel: url scheme



              Link for openURL documentation






              share|improve this answer




















              • 2





                The 1st format does not work on the device.

                – joshis
                Jun 29 '12 at 14:47















              43














              The iphone will dial a number using either of the formats listed below. But, it will do nothing if you are in the simulator. It took me 30 minutes of banging my head to figure this out.



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

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

              [[UIApplication sharedApplication]
              openURL:[NSURL URLWithString:@"tel:1-541-555-1234"]];


              Link for Apple documentation on the tel: url scheme



              Link for openURL documentation






              share|improve this answer




















              • 2





                The 1st format does not work on the device.

                – joshis
                Jun 29 '12 at 14:47













              43












              43








              43







              The iphone will dial a number using either of the formats listed below. But, it will do nothing if you are in the simulator. It took me 30 minutes of banging my head to figure this out.



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

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

              [[UIApplication sharedApplication]
              openURL:[NSURL URLWithString:@"tel:1-541-555-1234"]];


              Link for Apple documentation on the tel: url scheme



              Link for openURL documentation






              share|improve this answer















              The iphone will dial a number using either of the formats listed below. But, it will do nothing if you are in the simulator. It took me 30 minutes of banging my head to figure this out.



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

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

              [[UIApplication sharedApplication]
              openURL:[NSURL URLWithString:@"tel:1-541-555-1234"]];


              Link for Apple documentation on the tel: url scheme



              Link for openURL documentation







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Dec 19 '13 at 8:03









              Yasmin Tiomkin

              1492 silver badges14 bronze badges




              1492 silver badges14 bronze badges










              answered Oct 27 '09 at 5:20









              bentfordbentford

              17.5k6 gold badges53 silver badges56 bronze badges




              17.5k6 gold badges53 silver badges56 bronze badges







              • 2





                The 1st format does not work on the device.

                – joshis
                Jun 29 '12 at 14:47












              • 2





                The 1st format does not work on the device.

                – joshis
                Jun 29 '12 at 14:47







              2




              2





              The 1st format does not work on the device.

              – joshis
              Jun 29 '12 at 14:47





              The 1st format does not work on the device.

              – joshis
              Jun 29 '12 at 14:47













              7














              As @bentford said one might get miscarried because the simulator does show an alert when you try to click on a phone on the contacts app, this is just an alert that gets generated because the app checks whether or not the tel: protocol is supported on the device or not.



              Adding to what he writes you might want to also add support to escape any special characters or spaces as in:



              NSString *phoneStr = [NSString stringWithFormat:@"tel:%@",[self.contactDetails objectForKey:@"phone"]];
              NSString *escaped = [phoneStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
              [[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];


              Hope it helps.



              Cheers.






              share|improve this answer





























                7














                As @bentford said one might get miscarried because the simulator does show an alert when you try to click on a phone on the contacts app, this is just an alert that gets generated because the app checks whether or not the tel: protocol is supported on the device or not.



                Adding to what he writes you might want to also add support to escape any special characters or spaces as in:



                NSString *phoneStr = [NSString stringWithFormat:@"tel:%@",[self.contactDetails objectForKey:@"phone"]];
                NSString *escaped = [phoneStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];


                Hope it helps.



                Cheers.






                share|improve this answer



























                  7












                  7








                  7







                  As @bentford said one might get miscarried because the simulator does show an alert when you try to click on a phone on the contacts app, this is just an alert that gets generated because the app checks whether or not the tel: protocol is supported on the device or not.



                  Adding to what he writes you might want to also add support to escape any special characters or spaces as in:



                  NSString *phoneStr = [NSString stringWithFormat:@"tel:%@",[self.contactDetails objectForKey:@"phone"]];
                  NSString *escaped = [phoneStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];


                  Hope it helps.



                  Cheers.






                  share|improve this answer















                  As @bentford said one might get miscarried because the simulator does show an alert when you try to click on a phone on the contacts app, this is just an alert that gets generated because the app checks whether or not the tel: protocol is supported on the device or not.



                  Adding to what he writes you might want to also add support to escape any special characters or spaces as in:



                  NSString *phoneStr = [NSString stringWithFormat:@"tel:%@",[self.contactDetails objectForKey:@"phone"]];
                  NSString *escaped = [phoneStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:escaped]];


                  Hope it helps.



                  Cheers.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 12 '18 at 8:51









                  Stunner

                  8,19310 gold badges70 silver badges129 bronze badges




                  8,19310 gold badges70 silver badges129 bronze badges










                  answered Jul 21 '10 at 12:41









                  samiqsamiq

                  2,1441 gold badge23 silver badges26 bronze badges




                  2,1441 gold badge23 silver badges26 bronze badges





















                      6














                      (and )are actually no problem if you use stringByAddingPercentEscapesUsingEncoding as suggested by samiq. Same goes for +, / and spaces. It's a URL, so escaping seems natural.



                      If I'm guessing right, Apple's regular phone number recognition will be used in the tel: scheme handler, if you escape correctly.



                      (missing reputation to make it a comment)






                      share|improve this answer



























                        6














                        (and )are actually no problem if you use stringByAddingPercentEscapesUsingEncoding as suggested by samiq. Same goes for +, / and spaces. It's a URL, so escaping seems natural.



                        If I'm guessing right, Apple's regular phone number recognition will be used in the tel: scheme handler, if you escape correctly.



                        (missing reputation to make it a comment)






                        share|improve this answer

























                          6












                          6








                          6







                          (and )are actually no problem if you use stringByAddingPercentEscapesUsingEncoding as suggested by samiq. Same goes for +, / and spaces. It's a URL, so escaping seems natural.



                          If I'm guessing right, Apple's regular phone number recognition will be used in the tel: scheme handler, if you escape correctly.



                          (missing reputation to make it a comment)






                          share|improve this answer













                          (and )are actually no problem if you use stringByAddingPercentEscapesUsingEncoding as suggested by samiq. Same goes for +, / and spaces. It's a URL, so escaping seems natural.



                          If I'm guessing right, Apple's regular phone number recognition will be used in the tel: scheme handler, if you escape correctly.



                          (missing reputation to make it a comment)







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jun 29 '11 at 21:26









                          SebastianSebastian

                          1,0861 gold badge13 silver badges13 bronze badges




                          1,0861 gold badge13 silver badges13 bronze badges





















                              4














                              If your phone number has ( or ) in it, the Phone app will not launch.






                              share|improve this answer























                              • FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

                                – Gabriel Osorio
                                Jul 30 '14 at 19:22















                              4














                              If your phone number has ( or ) in it, the Phone app will not launch.






                              share|improve this answer























                              • FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

                                – Gabriel Osorio
                                Jul 30 '14 at 19:22













                              4












                              4








                              4







                              If your phone number has ( or ) in it, the Phone app will not launch.






                              share|improve this answer













                              If your phone number has ( or ) in it, the Phone app will not launch.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Dec 6 '10 at 7:38









                              WrightsCSWrightsCS

                              46.2k21 gold badges126 silver badges173 bronze badges




                              46.2k21 gold badges126 silver badges173 bronze badges












                              • FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

                                – Gabriel Osorio
                                Jul 30 '14 at 19:22

















                              • FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

                                – Gabriel Osorio
                                Jul 30 '14 at 19:22
















                              FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

                              – Gabriel Osorio
                              Jul 30 '14 at 19:22





                              FWIW, I've tried several alternatives including (xxx)-xxx-xxxx and parenthesis doesn't seem to be a problem on iOS 7. Though blank spaces seems to hinder the Phone app from launching.

                              – Gabriel Osorio
                              Jul 30 '14 at 19:22











                              3














                              Haven't had any problems with it using tel:phone-number and invoking it the same way you are. Only works on the iPhone device, though.



                              One thing I did have to do was strip out extraneous characters (like all parentheses, spaces, dashes and dots) out of the phone string. Some of the examples above (but not the original post) have dashes. That might be the problem.






                              share|improve this answer























                              • Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

                                – bentford
                                Oct 27 '09 at 5:24















                              3














                              Haven't had any problems with it using tel:phone-number and invoking it the same way you are. Only works on the iPhone device, though.



                              One thing I did have to do was strip out extraneous characters (like all parentheses, spaces, dashes and dots) out of the phone string. Some of the examples above (but not the original post) have dashes. That might be the problem.






                              share|improve this answer























                              • Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

                                – bentford
                                Oct 27 '09 at 5:24













                              3












                              3








                              3







                              Haven't had any problems with it using tel:phone-number and invoking it the same way you are. Only works on the iPhone device, though.



                              One thing I did have to do was strip out extraneous characters (like all parentheses, spaces, dashes and dots) out of the phone string. Some of the examples above (but not the original post) have dashes. That might be the problem.






                              share|improve this answer













                              Haven't had any problems with it using tel:phone-number and invoking it the same way you are. Only works on the iPhone device, though.



                              One thing I did have to do was strip out extraneous characters (like all parentheses, spaces, dashes and dots) out of the phone string. Some of the examples above (but not the original post) have dashes. That might be the problem.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered May 13 '09 at 4:34









                              RaminRamin

                              13k3 gold badges28 silver badges33 bronze badges




                              13k3 gold badges28 silver badges33 bronze badges












                              • Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

                                – bentford
                                Oct 27 '09 at 5:24

















                              • Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

                                – bentford
                                Oct 27 '09 at 5:24
















                              Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

                              – bentford
                              Oct 27 '09 at 5:24





                              Dashes are OK per the documentation: developer.apple.com/iphone/library/featuredarticles/…

                              – bentford
                              Oct 27 '09 at 5:24











                              3














                              I found that the issue was due to characters that where not allowed for tel:// URI - the following code solved my problem:



                              NSMutableCharacterSet *charSet = [NSMutableCharacterSet new];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];
                              NSArray *arrayWithNumbers = [str componentsSeparatedByCharactersInSet:charSet];
                              NSString *numberStr = [arrayWithNumbers componentsJoinedByString:@""];





                              share|improve this answer


















                              • 2





                                This code will also remove "+" character from the international country codes.

                                – Shmidt
                                Dec 5 '13 at 10:32











                              • I prefer this answer for filtering questionable "phone number" strings. Thanks!

                                – quickthyme
                                Feb 2 '16 at 1:19















                              3














                              I found that the issue was due to characters that where not allowed for tel:// URI - the following code solved my problem:



                              NSMutableCharacterSet *charSet = [NSMutableCharacterSet new];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];
                              NSArray *arrayWithNumbers = [str componentsSeparatedByCharactersInSet:charSet];
                              NSString *numberStr = [arrayWithNumbers componentsJoinedByString:@""];





                              share|improve this answer


















                              • 2





                                This code will also remove "+" character from the international country codes.

                                – Shmidt
                                Dec 5 '13 at 10:32











                              • I prefer this answer for filtering questionable "phone number" strings. Thanks!

                                – quickthyme
                                Feb 2 '16 at 1:19













                              3












                              3








                              3







                              I found that the issue was due to characters that where not allowed for tel:// URI - the following code solved my problem:



                              NSMutableCharacterSet *charSet = [NSMutableCharacterSet new];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];
                              NSArray *arrayWithNumbers = [str componentsSeparatedByCharactersInSet:charSet];
                              NSString *numberStr = [arrayWithNumbers componentsJoinedByString:@""];





                              share|improve this answer













                              I found that the issue was due to characters that where not allowed for tel:// URI - the following code solved my problem:



                              NSMutableCharacterSet *charSet = [NSMutableCharacterSet new];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];
                              [charSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];
                              NSArray *arrayWithNumbers = [str componentsSeparatedByCharactersInSet:charSet];
                              NSString *numberStr = [arrayWithNumbers componentsJoinedByString:@""];






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jul 23 '11 at 14:18









                              Gil MargolinGil Margolin

                              1,42117 silver badges20 bronze badges




                              1,42117 silver badges20 bronze badges







                              • 2





                                This code will also remove "+" character from the international country codes.

                                – Shmidt
                                Dec 5 '13 at 10:32











                              • I prefer this answer for filtering questionable "phone number" strings. Thanks!

                                – quickthyme
                                Feb 2 '16 at 1:19












                              • 2





                                This code will also remove "+" character from the international country codes.

                                – Shmidt
                                Dec 5 '13 at 10:32











                              • I prefer this answer for filtering questionable "phone number" strings. Thanks!

                                – quickthyme
                                Feb 2 '16 at 1:19







                              2




                              2





                              This code will also remove "+" character from the international country codes.

                              – Shmidt
                              Dec 5 '13 at 10:32





                              This code will also remove "+" character from the international country codes.

                              – Shmidt
                              Dec 5 '13 at 10:32













                              I prefer this answer for filtering questionable "phone number" strings. Thanks!

                              – quickthyme
                              Feb 2 '16 at 1:19





                              I prefer this answer for filtering questionable "phone number" strings. Thanks!

                              – quickthyme
                              Feb 2 '16 at 1:19











                              2














                              I just ran into this when trying to add a "Call" button to a UIAlertView. I had the following code to handle the call:



                              - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

                              if (buttonIndex != 0)

                              [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-602-555-1212"]];




                              It wouldn't open anything, just like you. I even tried a regular http URL. It turned out I had forgotten to set the delegate to self. That's probably your problem also.






                              share|improve this answer



























                                2














                                I just ran into this when trying to add a "Call" button to a UIAlertView. I had the following code to handle the call:



                                - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

                                if (buttonIndex != 0)

                                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-602-555-1212"]];




                                It wouldn't open anything, just like you. I even tried a regular http URL. It turned out I had forgotten to set the delegate to self. That's probably your problem also.






                                share|improve this answer

























                                  2












                                  2








                                  2







                                  I just ran into this when trying to add a "Call" button to a UIAlertView. I had the following code to handle the call:



                                  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

                                  if (buttonIndex != 0)

                                  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-602-555-1212"]];




                                  It wouldn't open anything, just like you. I even tried a regular http URL. It turned out I had forgotten to set the delegate to self. That's probably your problem also.






                                  share|improve this answer













                                  I just ran into this when trying to add a "Call" button to a UIAlertView. I had the following code to handle the call:



                                  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

                                  if (buttonIndex != 0)

                                  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-602-555-1212"]];




                                  It wouldn't open anything, just like you. I even tried a regular http URL. It turned out I had forgotten to set the delegate to self. That's probably your problem also.







                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered May 13 '09 at 2:20









                                  bbrownbbrown

                                  5,5425 gold badges33 silver badges41 bronze badges




                                  5,5425 gold badges33 silver badges41 bronze badges





















                                      1














                                      some additional info about making phone calls via url scheme (as I think someone may find it useful)



                                      How to use tel: with * (star, asterisk) or # (hash, pound) on iOs?






                                      share|improve this answer





























                                        1














                                        some additional info about making phone calls via url scheme (as I think someone may find it useful)



                                        How to use tel: with * (star, asterisk) or # (hash, pound) on iOs?






                                        share|improve this answer



























                                          1












                                          1








                                          1







                                          some additional info about making phone calls via url scheme (as I think someone may find it useful)



                                          How to use tel: with * (star, asterisk) or # (hash, pound) on iOs?






                                          share|improve this answer















                                          some additional info about making phone calls via url scheme (as I think someone may find it useful)



                                          How to use tel: with * (star, asterisk) or # (hash, pound) on iOs?







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited May 23 '17 at 12:13









                                          Community

                                          11 silver badge




                                          11 silver badge










                                          answered Feb 23 '12 at 10:37









                                          HlungHlung

                                          9,7144 gold badges57 silver badges82 bronze badges




                                          9,7144 gold badges57 silver badges82 bronze badges





















                                              1














                                              I got the same problem and at last I found the reason was that there was a space in the phone number (for better formatting). After removing the space it worked fine.






                                              share|improve this answer





























                                                1














                                                I got the same problem and at last I found the reason was that there was a space in the phone number (for better formatting). After removing the space it worked fine.






                                                share|improve this answer



























                                                  1












                                                  1








                                                  1







                                                  I got the same problem and at last I found the reason was that there was a space in the phone number (for better formatting). After removing the space it worked fine.






                                                  share|improve this answer















                                                  I got the same problem and at last I found the reason was that there was a space in the phone number (for better formatting). After removing the space it worked fine.







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited Mar 26 at 7:32









                                                  Eugene Berdnikov

                                                  1,0242 gold badges10 silver badges21 bronze badges




                                                  1,0242 gold badges10 silver badges21 bronze badges










                                                  answered Feb 4 '11 at 11:41









                                                  boreasboreas

                                                  6581 gold badge12 silver badges25 bronze badges




                                                  6581 gold badge12 silver badges25 bronze badges





















                                                      0














                                                      Here is an update on how to derive a phone number in 2018 (where iOS 11 and 12 are most common):



                                                      NSString *phoneNumberURLString = [@"tel://" stringByAppendingString:[result.phoneNumber
                                                      stringByAddingPercentEncodingWithAllowedCharacters:
                                                      [NSCharacterSet URLPathAllowedCharacterSet]]];
                                                      NSURL *phoneNumberURL = [NSURL URLWithString:phoneNumberURLString];


                                                      samiq's answer was what I used initially until I found that my app would crash due to a nil NSURL being created (and later being passed into a collection object) due to failing to properly escape a phone number formatted like so: (###) ###-####. The aforementioned code resolves this.






                                                      share|improve this answer



























                                                        0














                                                        Here is an update on how to derive a phone number in 2018 (where iOS 11 and 12 are most common):



                                                        NSString *phoneNumberURLString = [@"tel://" stringByAppendingString:[result.phoneNumber
                                                        stringByAddingPercentEncodingWithAllowedCharacters:
                                                        [NSCharacterSet URLPathAllowedCharacterSet]]];
                                                        NSURL *phoneNumberURL = [NSURL URLWithString:phoneNumberURLString];


                                                        samiq's answer was what I used initially until I found that my app would crash due to a nil NSURL being created (and later being passed into a collection object) due to failing to properly escape a phone number formatted like so: (###) ###-####. The aforementioned code resolves this.






                                                        share|improve this answer

























                                                          0












                                                          0








                                                          0







                                                          Here is an update on how to derive a phone number in 2018 (where iOS 11 and 12 are most common):



                                                          NSString *phoneNumberURLString = [@"tel://" stringByAppendingString:[result.phoneNumber
                                                          stringByAddingPercentEncodingWithAllowedCharacters:
                                                          [NSCharacterSet URLPathAllowedCharacterSet]]];
                                                          NSURL *phoneNumberURL = [NSURL URLWithString:phoneNumberURLString];


                                                          samiq's answer was what I used initially until I found that my app would crash due to a nil NSURL being created (and later being passed into a collection object) due to failing to properly escape a phone number formatted like so: (###) ###-####. The aforementioned code resolves this.






                                                          share|improve this answer













                                                          Here is an update on how to derive a phone number in 2018 (where iOS 11 and 12 are most common):



                                                          NSString *phoneNumberURLString = [@"tel://" stringByAppendingString:[result.phoneNumber
                                                          stringByAddingPercentEncodingWithAllowedCharacters:
                                                          [NSCharacterSet URLPathAllowedCharacterSet]]];
                                                          NSURL *phoneNumberURL = [NSURL URLWithString:phoneNumberURLString];


                                                          samiq's answer was what I used initially until I found that my app would crash due to a nil NSURL being created (and later being passed into a collection object) due to failing to properly escape a phone number formatted like so: (###) ###-####. The aforementioned code resolves this.







                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered Nov 12 '18 at 8:56









                                                          StunnerStunner

                                                          8,19310 gold badges70 silver badges129 bronze badges




                                                          8,19310 gold badges70 silver badges129 bronze badges





















                                                              -3














                                                              The URL should be tel://3035551212 and not tel:3035551212...
                                                              Add that // and it should work.






                                                              share|improve this answer























                                                              • I tried that earlier without success. Thanks.

                                                                – denton
                                                                May 1 '09 at 18:11






                                                              • 1





                                                                Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                                                                – bbrown
                                                                May 13 '09 at 2:22















                                                              -3














                                                              The URL should be tel://3035551212 and not tel:3035551212...
                                                              Add that // and it should work.






                                                              share|improve this answer























                                                              • I tried that earlier without success. Thanks.

                                                                – denton
                                                                May 1 '09 at 18:11






                                                              • 1





                                                                Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                                                                – bbrown
                                                                May 13 '09 at 2:22













                                                              -3












                                                              -3








                                                              -3







                                                              The URL should be tel://3035551212 and not tel:3035551212...
                                                              Add that // and it should work.






                                                              share|improve this answer













                                                              The URL should be tel://3035551212 and not tel:3035551212...
                                                              Add that // and it should work.







                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered May 1 '09 at 17:47









                                                              MugunthMugunth

                                                              11.6k14 gold badges60 silver badges92 bronze badges




                                                              11.6k14 gold badges60 silver badges92 bronze badges












                                                              • I tried that earlier without success. Thanks.

                                                                – denton
                                                                May 1 '09 at 18:11






                                                              • 1





                                                                Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                                                                – bbrown
                                                                May 13 '09 at 2:22

















                                                              • I tried that earlier without success. Thanks.

                                                                – denton
                                                                May 1 '09 at 18:11






                                                              • 1





                                                                Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                                                                – bbrown
                                                                May 13 '09 at 2:22
















                                                              I tried that earlier without success. Thanks.

                                                              – denton
                                                              May 1 '09 at 18:11





                                                              I tried that earlier without success. Thanks.

                                                              – denton
                                                              May 1 '09 at 18:11




                                                              1




                                                              1





                                                              Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                                                              – bbrown
                                                              May 13 '09 at 2:22





                                                              Not true. Either works and Apple's documentation suggests the poster's version: developer.apple.com/iphone/library/featuredarticles/…

                                                              – bbrown
                                                              May 13 '09 at 2:22

















                                                              draft saved

                                                              draft discarded
















































                                                              Thanks for contributing an answer to Stack Overflow!


                                                              • Please be sure to answer the question. Provide details and share your research!

                                                              But avoid


                                                              • Asking for help, clarification, or responding to other answers.

                                                              • Making statements based on opinion; back them up with references or personal experience.

                                                              To learn more, see our tips on writing great answers.




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f812243%2fproblem-using-tel-url-to-initiate-a-call%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                                                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현