class func openFacebook(id: String){ //id is a username in this case
let name = id.replace(" ", withString: "")
let hook = "fb://profile/" + name
let hookURL = NSURL(string: hook)
if UIApplication.sharedApplication().canOpenURL(hookURL!){
UIApplication.sharedApplication().openURL(hookURL!)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "http://facebook.com/" + name)!)
}
}
I try to do this, but it never opens the app. It always opens the browser. I'm not using the facebook sdk. I just want to open facebook from my app, to the user's profile.