views:

5514

answers:

3

This might be a rather obvious question, but can you launch the Safari browser from an iphone app?

all the best.

+2  A: 

Have you tried the openURL function?

John Boker
+6  A: 

UIApplication has a method called openURL:

example:

NSURL *url = [NSURL URLWithString:@"http://www.stackoverflow.com"];

if (![[UIApplication sharedApplication] openURL:url])
  NSLog(@"%@%@",@"Failed to open url:",[url description]);
Brad Smith
Your code is right in principle but wrong in practice, see surtyaarthoughts answer.
Toby Allen
Why "wrong in practice"?
Rafael Vega
+13  A: 

should be the following :

NSURL *url = [NSURL URLWithString:@"http://www.stackoverflow.com"];

if (![[UIApplication sharedApplication] openURL:url])

NSLog(@"%@%@",@"Failed to open url:",[url description]);
surtyaar