initiate a call from iphone app

Discussion in 'iPhone Tips, Help and Troubleshooting' started by JZN2000, Sep 19, 2008.

  1. JZN2000 macrumors newbie

    Sep 19, 2008

    i am developing an application that needs to initiate a call, i am trying

    self.number = @"18003998651";

    UIApplication *app = [UIApplication sharedApplication]; NSString *num = [NSString stringWithFormat:mad:"tel://%@", self.number]; NSString *fixNum = [num stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:fixNum]; [app openURL:url];

    i have also tried it with "tel:%@" instead of @"tel://%@"

    but it shows alert : url unsupported, this url wasnt loaded

    could you tell me what is the problem

    Secondly how can i connect my xcode to my iphone device, so that application runs directly into iphone device

  2. Quincy9219 macrumors regular

    Aug 8, 2008
    The answer to your first question is very simple, any 3rd party application cannot access another app. All third party apps are required to stay in their sandbox, as it is called, only official Apple apps can, say make a call or send a text message. Out of curiosity, why would an app need to make a call? It sounds to me like a scam to send a number to a server to open a user up to spamming.
  3. rogersmj macrumors 68020


    Sep 10, 2006
    Indianapolis, IN
    You're generalizing, and you're at least partly incorrect. He's not trying to access another app, just open it and pass in an argument. The iPhone detects phone numbers in other applications, and launches the phone app when you click on them. Similarly, third-party apps can open the Email application and pass in various email parameters to set up a message, which is the exact same behavior as passing a phone number to the Phone app. I don't know the programmatic answer to this question, but since this is possible with email and other apps have been proven to be able to open the phone, I think it's worth discussion.

    And why are you so negative anyway? Not only do you shoot his question down, but you're just assuming that he's going to use it to spam people?? What exactly makes it "sound" to you like he's setting up a scam? Just because you can't imagine anything else? God, some people...I'm so sick of cynics, everywhere.

    JZN2000: Regarding using the physical iPhone...I'm pretty new to iPhone development, but I did notice today that when I plugged in my iPhone while xcode was open, a dialog popped up and asked if I wanted to use that device (iPhone) for development. Do you not get that message?
  4. Quincy9219 macrumors regular

    Aug 8, 2008
    Because of how easy it is to do damage to people through cellphones. Because he wants an app to 'dial home' which, how many uses can you think of for that? And those other apps, they just open the app, they don't send the email for you. Perhaps you are right and the app can be opened, but if it dials on it's own, Apple will never let it through. Actually, you are probably right and the app can be opened, but it is getting hung up on the auto dialing. Even if you sort it out, good luck getting it through the gauntlet, it'll never get through
  5. JZN2000 thread starter macrumors newbie

    Sep 19, 2008
    why iam using it


    actually i want to make an application that will by pressing a button dial a number of my call centre. rather than dialing it maually or from contacts.

    secondly, according to the documentation by apple, this should work fine, i also tried launching safari and it worked fine, documentation says when you use this method an alert is shown , to confirm to dial a particular number if we press call than only it will call, so no way to use it negatively.

    actually i want to know that y its not working, is there any prob in code, or somthing else?


Share This Page