Opening The Facebook App To Your Facebook Fan Page

Guest author Robert Strojan (@blackoutrobb) is the founder and lead iPhone app developer at Blackout Labs. He is also a speaker at the 360|iDev Conference in April.

In September I wrote a post on iPhoneDevTools.com about opening the Facebook iPhone app from within another app or from the web with the Facebook app’s custom URLs. I got a lot of questions about how to open the Facebook app directly to a fan page or application page allowing an app’s users to add themselves as Facebook fans.

The most widely used method of opening a Facebook fan page is to open it in Safari or an in-app browser. The issue with this method is that iPhone users likely use the Facebook iPhone app and, consequently, won’t be logged-in in the browser. The extra hurdle of logging in is a significant factor in app-to-Facebook-fan conversion rates. It would be nice to open the Facebook app directly to a fan page allowing the user to add themselves as a fan in a single tap. Here’s how:

The Facebook app is accessible via the custom URL protocol ‘fb://’. There are several domains you can add next to access different parts of the Facebook app. One is ‘profile’. A specific profile can be opened by adding the unique ID of the fan page as a path to the domain. Here’s how I open my recently created Blackout Labs fan page:

I got my Blackout Labs Fan page unique ID by looking at the address bar of my Fan Page:

Some pages won’t have an ID in the address bar. For those, click on your Fan Page profile pic and on the profile pic page you’ll see the parameter ‘id=’ in the address bar which indicates your fan page’s ID.

Now I can open the Blackout Labs fan page directly in the Facebook app with URL fb://profile/210227459693. If you’re currently browsing on the iPhone, tap that link to open the Facebook app directly to my fan page. Here’s what you’ll see:

The Objective-C code is simple: Open the URL with an instance of ‘sharedApplication’. An if-statement ensures that the fan page will open in Safari if the user doesn’t have the Facebook app installed.

NSURL *fanPageURL = [NSURL URLWithString:@"fb://profile/210227459693"];

if (![[UIApplication sharedApplication] openURL: fanPageURL]) {
        //fanPageURL failed to open.  Open the website in Safari instead
        NSURL *webURL = [NSURL URLWithString:@"http://www.facebook.com/pages/Blackout-Labs/210227459693"];
        [[UIApplication sharedApplication] openURL: webURL];
}

The method also works for Facebook apps. If you’ve created an iPhone app that utilizes Facebook connect, then you already have a fan page setup for your app. You can use the same method above to open your Facebook Connect application’s fan page.

Now I wish I could end it there. I’m not affiliated with Facebook and unfortunately, this information hasn’t yet been officially released by Facebook; possibly because the URLs are not yet stable enough for use. I’ve actually encountered a couple bugs in the process of using the URL including the “Become a Fan” button not appearing consistently and my fan page details not showing up every time the app is opened via a custom URL. Furthermore, the URLs aren’t guaranteed to be supported in future versions of the Facebook iPhone app. In other words, make sure you test your implementation with your Facebook fan or app page, and weigh the risks of possible bugs and future incompatibility with the potential of increased fan conversion rates.

Thanks to Robert for contributing this piece! Want to contribute something? Send your topic and a writing sample to dan at mobileorchard.com

examsheets – http://www.examsheets.com/onlinetest/ASVAB.htmbraindumps – braindumps 70-642selftestengine – http://www.selftestengine.com/ccna-certification.htmlcertkiller – http://www.certkiller.com/admissiontest/gre-test.htmtestking – http://www.testking.com/techking/infographics/the-most-popular-design-blogs-by-twitter-followers-and-facebook-fans/


© 2008-2051 • Mobile Orchard and the Bar-Tree Logo are service marks. ContactAdvertise