I'm trying to open a facebook page from my app. Here is the code:
let facebookWebURL = URL.init(string: "https://www.facebook.com/aviramnet")
let facebookAppURL = URL.init(string: "fb://profile/220780122049926")
if (UIApplication.shared.canOpenURL(facebookAppURL!)){
UIApplication.shared.open(facebookAppURL!, options: [:], completionHandler: nil)
}else{
UIApplication.shared.open(facebookWebURL!, options: [:], completionHandler: nil)
}
But it only opens the app on Safari browser. Did I miss something?
And yes, I have the Facebook app installed.
you need to add in the app's info.plist :
under the LSApplicationQueriesSchemes array add an item:
fb for facebook, and instagram for instagram :