Advertisement
riit1564

Code snippet to open safari view controller

Oct 3rd, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Write the following lines in your ios app if you want to open a website in safari view controller. Once you trigger this code from inside your app, it will open Safari view controller with the given website.
  2.  
  3. NSURL *url = [NSURL URLWithString:@"https://developer.amazon.com"];
  4. NSLog(@"Opening following URL: %@ with SafariViewController.", url.absoluteString);
  5. SFSafariViewController *safariVC = [[SFSafariViewController alloc] initWithURL:url];
  6.  
  7. [self presentViewController:self.safariVC animated:YES completion:nil];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement