I placed a Facebook button in my iPhone app. How to open the iPhone's default browser when clicking on that button and loads the Facebook login page?
From your Home page, head to Settings. Select Apps. Tap on the three-dotted icon in the upper-right corner of the screen. Choose your default apps.
Tap "Default Browser App"Tap More ( ) on your screen, then Settings. In Settings tap Default Browser > Open Chrome Settings. Tap Default Browser App and select Chrome.
iOS 10 has introduced new method to open a URL, see below:
Swift 3:
let url = URL(string:"http://www.booleanbites.com")! if #available(iOS 10.0, *) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } else { // Fallback on earlier versions UIApplication.shared.openURL(url) }
Objective C:
NSURL *url = [NSURL URLWithString:@"http://www.booleanbites.com"]; if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) { [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:NULL]; }else{ // Fallback on earlier versions [[UIApplication sharedApplication] openURL:url]; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With