Calling a Phone Number

One of the most important hardware features of most mobile devices is the phone. You can also integrate the phone functionality into your app by letting the user call relevant numbers from within the app. Calling a phone number launches the Phone app on the phone, but control is returned to your app when the call is done.

Calling a phone number from within your app is very simple and requires only a single line of code:

[[UIApplication sharedApplication]openURL:                           [NSURL URLWithString:@"telprompt://1234567894"]];

This tells the phone to launch the URL. Any URL starting with telprompt:// will be treated like a phone number. Other URL schemes open other apps. For instance, ...

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.