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:
http://www.facebook.com/AlibabaUS
Thank you.
Originally, Facebook only developed React Native to support iOS. However, with it's recent support of the Android operating system, the library can now provide mobile UIs for both platforms.
Here are some schemes the Facebook app uses, there are a ton more on the source link:
NSURL *url = [NSURL URLWithString:@"fb://profile/<id>"]; [[UIApplication sharedApplication] openURL:url];
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 }
http://wiki.akosma.com/IPhone_URL_Schemes#Facebook
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With