If the native Facebook app is installed on the iPhone. How do I open a facebook link into the native Facebook app from my app. In the case of opening by Safari, the link is same as:
Thank you.
If the native Facebook app is installed on the iPhone. How do I open a facebook link into the native Facebook app from my app. In the case of opening by Safari, the link is same as:
Thank you.
I know the question is old, but in support of the above answers i wanted to share my working code. Just add these two methods to whatever class.The code checks if facebook app is installed, if not installed the url is opened in a browser.And if any errors occur when trying to find the profileId, the page will be opened in a browser. Just pass the url(example, http://www.facebook.com/AlibabaUS) to openUrl: and it will do all the magic. Hope it helps someone!.
swift 3
To add yonix’s comment as an answer, the old
fb://page/…
URL no longer works. Apparently it was replaced byfb://profile/…
, even though a page is not a profile.I did this in MonoTouch in the following method, I'm sure a pure Obj-C based approach wouldn't be too different. I used this inside a class which had changing URLs at times which is why I just didn't put it in a if/elseif statement.
The break is not always called before your app changes to Safari/Facebook. I assume your program will halt there and call it when you come back to it.
If the Facebook application is logged in, the page will be opened when executing the following code. If the Facebook application is not logged in when executing the code, the user will then be redirected to the Facebook app to login and then after connecting the Facebook is not redirected to the page!
Just use https://graph.facebook.com/(your_username or page name) to get your page ID and after you can see all the detain and your ID
after in your IOS app use :