How to open the Facebook App from your own iOS App

Thanks to Custom URL Schemes, iOS Apps can register themselves and be “woken up” by another app (such as yours). Many can even accept parameters if you do.

Opening another app happens via the UIApplication class, and an NSURL as parameter.

Here’s how we open the Facebook App and direct it to open my Pinkstone Pictures page in it:

If the app is not installed nothing happens – which may mean that the app is not installed. As a fallback we’re opening the same page with Safari. If that also doesn’t work, a log message is displayed.

Note that to pass your page into the Facebook App you need your Page or Profile ID. There are several ways to find those:

To find out which other apps you can opened and to figure out which scheme they follow:

To register a Custom URL Scheme in your own app:

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

2 thoughts on “How to open the Facebook App from your own iOS App

  1. Nice little code! I worked that into my app and when I click the Facebook nav bar button, it takes the user to the view controller with your code in it that links and opens the user’s Facebook app. Going back into my app though, that button no longer functions and remains a blank view above the nav bar. I have to reset the app before it performs that link again. How could I fix that?

    1. Thanks Bobby! Difficult to say why this happens without seeing how you’re calling the function. I’m calling this from a standard UIButton and it works fine when I go back into the app.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.