How can I launch Safari from an iPhone app?

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


should be the following :

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

if (![[UIApplication sharedApplication] openURL:url]) {
    NSLog(@"%@%@",@"Failed to open url:",[url description]);
}

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

you can open the url in safari with this:

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