How can I launch Safari from an iPhone app?

Viewed 84459

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

7 Answers

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]);
}
Related