How can I validate if a URL in my database is NULL and if so, show an alert but if it has a URL, open it
func Facebook(sender: AnyObject) {
if let url = NSURL(string: face){
let alert = UIAlertView(title: "Aviso!!!", message: "Mmmm, no tengo url!", delegate: nil,
cancelButtonTitle: "OK")
alert.show()
UIApplication.sharedApplication().openURL(url)
}
}
This way I get the data
values = ((try! NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments)) as? NSArray)!<br/>
face = values[indexPath.row]["facebook"] as! String