Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UIApplication.sharedApplication().openURL(NSURL.URLWithString("https://www.google.com"))
- //Check if is a valid URL
- guard let url = NSURL(string: "https://www.google.com.br") else
- {
- print("Error to upen url")
- return
- }
- //Check if can open URL
- guard UIApplication.sharedApplication().canOpenURL(url) else
- {
- print("Can't open URL")
- return
- }
- //If reach this point... You have a valid URL and your app can open it.
- UIApplication.sharedApplication().openURL(url)
- //If you still have a BAD_EXEC over here... believe... itΒ΄s some kind of witchcraft :O
Add Comment
Please, Sign In to add comment