Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

spiffers

Suspended
Original poster
Apr 12, 2009
104
88
Im working on an app and I have to be able to make phone calls from within my app. I have googled it, but did not find anything. Maybe Im not searching for the right thing? Would love some pointers to how to make phone calls programmatically.
 
You use well documented tel: URL scheme. This will open the Phone app with the phone number entered. The user can then initiate the call or not. There is no alternate way to dial without user approval.
 
Answer

Code:
[[UIApplication sharedApplication] OpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]]];
 
Last edited by a moderator:
Code:
[[UIApplication sharedApplication] [B][COLOR="Red"]OpenURL[/COLOR][/B]:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]]];
Well, not exactly. Remember that Objective-C is case-sensitive and UIApplication has no OpenURL: instance method.
 
Last edited:
From my own code..

But somehow the o in openURL got bigger...
this is the right one:
Code:
[[UIApplication sharedApplication] [COLOR="Red"]openURL[/COLOR]:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNumber]]];
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.