Open a facebook link by native Facebook app on iOS
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 :
NSURL *url = [NSURL URLWithString:@"fb://profile/[your ID]"];
[[UIApplication sharedApplication] openURL:url];
Here are some schemes the Facebook app uses, there are a ton more on the source link:
Example
NSURL *url = [NSURL URLWithString:@"fb://profile/<id>"];
[[UIApplication sharedApplication] openURL:url];
Schemes
fb://profile – Open Facebook app to the user’s profile
fb://friends – Open Facebook app to the friends list
fb://notifications – Open Facebook app to the notifications list (NOTE: there appears to be a bug with this URL. The Notifications page opens. However, it’s not possible to navigate to anywhere else in the Facebook app)
fb://feed – Open Facebook app to the News Feed
fb://events – Open Facebook app to the Events page
fb://requests – Open Facebook app to the Requests list
fb://notes – Open Facebook app to the Notes page
fb://albums – Open Facebook app to Photo Albums list
If before opening this url you want to check wether the user fas the facebook app you can do the following (as explained in another answer below):
if ([[UIApplication sharedApplication] canOpenURL:nsurl]){
[[UIApplication sharedApplication] openURL:nsurl];
}
else {
//Open the url as usual
}
Source
http://wiki.akosma.com/IPhone_URL_Schemes#Facebook
To add yonix’s comment as an answer, the old fb://page/…
URL no longer works. Apparently it was replaced by fb://profile/…
, even though a page is not a profile.