Xcode swift link to facebook page -
i have app button suppose open facebook page. checks see if user has facebook installed , should open page in app. if not installed, opens page safari. not working however. suspect has wrong address it, if user has facebook installed:

the problem format of facebook url notice format. use extension open urls. provide array of urls in order want them try opened , tries first 1 first , if fails goes second 1 , on:
extension uiapplication { class func tryurl(urls: [string]) { let application = uiapplication.sharedapplication() url in urls { if application.canopenurl(nsurl(string: url)!) { application.openurl(nsurl(string: url)!) return } } } } and use:
uiapplication.tryurl([ "fb://profile/116374146706", // app "http://www.facebook.com/116374146706" // website if app fails ])
Comments
Post a Comment