arfur arfur - 18 days ago 4
iOS Question

Cannot open safari from table

I am trying to learn how to use tables, I have my app which is a multiple view app. I can get it to load the table with data, when I click the table item I wanted it to load another viewcontroller, this wasn't working (no errors, just nothing changed), so I decided to test it with a safari page instead and this also doesn't do anything. Any ideas?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.

// SecondViewController *loadview = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
// ...
// Pass the selected object to the new view controller.
// [self.navigationController pushViewController:loadview animated:YES];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""]];
// [loadview release];



You have to write http:// in your URL string to open Safari with openURL: method.
Try this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""]];