Open a URL from your iPhone application!

If you need to open a web page from your iPhone application, one line of code is all you need! The most likely scenario of this is having a help or support link, within your application, for your users to click on. From there, it will launch Safari on the iPhone and go to your [...]

If you need to open a web page from your iPhone application, one line of code is all you need!

The most likely scenario of this is having a help or support link, within your application, for your users to click on. From there, it will launch Safari on the iPhone and go to your link.

You can use a button or any other clickable item.

Here is the code;

-(IBAction)openBrowser {
	// Launch the Satosoft website.
	[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.satosoft.com"]];
}

I’ve used an action from the Interface Builder, as a hidden button, kicks off the code!

Cheers

Graham

Tagged with:
 

Leave a Reply




Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!