DCDC DCDC - 24 days ago 7x
iOS Question

Swift - open web page in app, button doesn't react

I created a button to make a call from app:

@IBAction func callButton(sender: AnyObject) {
if (PhoneNumber != ""){
UIApplication.sharedApplication().openURL(NSURL(string: "telprompt://\(PhoneNumber)")!)

and it works perfectly fine. Strange thing happens when I want to open a web page. I use nearly exactly same code

@IBAction func openWeb(sender: AnyObject) {
UIApplication.sharedApplication().openURL(NSURL(string: "www.google.com")!)

But this time button doesn't react and nothing happens. Wherever I was looking for some information about opening web pages in safari from the app, the code was written exactly this way. Do you have any idea where the problem is?

Thanks in advance!


missing url scheme

UIApplication.sharedApplication().openURL(NSURL(string: "http://www.google.com")!)