I want to redirect user to my App\'s Facebook page, so I have the following code:
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString: @\"ht
Swift 2.3
For code you can use this example:
Note: If you can't find the facebook profile id can you use the follow site to do it (https://findmyfbid.com/)
func goFacebook() {
let profileID = "" //Here put profile id Example:'62260589592'
let facebookURL = NSURL(string: "fb://profile/\(profileID)")!
if UIApplication.sharedApplication().canOpenURL(facebookURL) {
UIApplication.sharedApplication().openURL(facebookURL)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/PageName")!)
}
}
For Info.plist you need set the follow parameters:
Note: For open the Info.plist on Source Mode
-Go to Info.plist file and click right
-Select "Open As"
-Select "Source Code"
-Put code above of another
LSApplicationQueriesSchemes
fb
fbapi
fbauth2
fbshareextension
fb-messenger-api