Make Better Things



I like to make better things.

Open Phone, SMS, Email, Map and browser apps in iPhone SDK

Here is how you can open default Phone app, SMS app, Email app, Maps app and browser app with openURL.

Open default Phone app in iPhone:


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

Open default SMS app in iPhone:


[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://466453"]];

Open default Email app in iPhone:


[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];

Open default Maps app in iPhone:


NSString* addressText = @"1 Infinite Loop, Cupertino, CA 95014";

// URL encode the spaces

addressText =  [addressText stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];

NSString* urlText = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];

// lets throw this text on the log so we can view the url in the event we have an issue

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

Open default Browser app in iPhone:


[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.makebetterthings.com/blogs/"]];

Category: iPhone

Tagged: