With so many awesome games and apps on the iPhone, it is easy to forget that it can actually be used to make phone calls. No, really, it’s true! And as is the case with so many other pieces of functionality, this is easy to accomplish with the iPhone SDK.
Like other phones, the iPhone supports the tel application protocol in URLs. This means that all we need to use is the trusty openURL method of the UIApplication class. We have previously discussed this method when pre-composing emails and, believe it or not, opening a URL.
The Code
Here is how to dial a phone number from your iPhone app in one line of code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:555-555-5555"]];
Dialing From a Web Page
You can also put links in your web pages that dial a phone number on the iPhone by using the tel protocol like so:
<a href="tel:555-555-5555">Dial 555-555-5555</a>
