Guest User

Untitled

a guest
Jan 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. UIApplication.sharedApplication().openURL(NSURL.URLWithString("https://www.google.com"))
  2.  
  3. //Check if is a valid URL
  4. guard let url = NSURL(string: "https://www.google.com.br") else
  5. {
  6. print("Error to upen url")
  7. return
  8. }
  9.  
  10. //Check if can open URL
  11. guard UIApplication.sharedApplication().canOpenURL(url) else
  12. {
  13. print("Can't open URL")
  14. return
  15. }
  16.  
  17. //If reach this point... You have a valid URL and your app can open it.
  18. UIApplication.sharedApplication().openURL(url)
  19.  
  20. //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