I have an app with a button that is suppose to open a Facebook page. It checks to see if the user has Facebook installed and should open the page in the app. If it is not installed, then it simply opens the page with Safari. It is not working however. I suspect it has something to do with the wrong address for it, if the user has Facebook installed:
var fbUrl = NSURL(string: "fb://facebook.com/FacebookPageName")!
var fbUrlWeb = NSURL(string: "https://www.facebook.com/FacebookPageName")!
if (UIApplication.sharedApplication().canOpenURL(fbUrl)) {
// Facebook App installed
UIApplication.sharedApplication().openURL(fbUrl)
} else {
// No Facebook App installed
UIApplication.sharedApplication().openURL(fbUrlWeb)
}