Launching Safari From Your App

This is one of the simplest things you can do, launch the Safari mobile browser from inside your iOS App.

Here’s how we’d launch it for SitterSat.

SitterSat AppStore Icon

SitterSat AppStore Icon

Let’s say I have a button on my app. The button is linked through the interface builder to a method that handles the click titled LaunchSafariButtonClick.  If I have any typos, sorry, I typed it out by hand real quick, but you get the idea I’m sure.

- (IBAction)LaunchSafariButtonClick:(UIButton *) sender {
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.sittersat.com"]];
}

Yep, you can use a UIWebView to display the page inside your app, but this is a quick way to launch Safari outside of your app.

Advertisements
Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: