Facebook Connect on iPhone

Yup. This is just another attempt to showcase Facebook Connect stuff in an iPhone application. I was working since last few days (taking time from my office) to get some Facebook Connect stuff working on an iPhone. As a summary of what this app does –:

  • Detects your current location using the iPhone Core Location framework.
  • Gets the closest Zip Code using GeoNames webservice. 
  • Allows to search for a place/thing near you, using the Google Local Search API.
  • Allows to publish a story onto your Facebook home page.

Thats all my app does. Here are some snap shots. The app is very much functional but might not look awesome like those sexy apps on www.apple.com. Sigh!, I can never be a designer.


Picture 2 Picture 1  Picture 10 Picture 4

Picture 8 Picture 5 Picture 6 Picture 7

So here is a quick summary of the tools I used to put this functionalities in an iPhone.

iPhone Core Location Framework – This is an inbuilt SDK component which is available for all iPhone developers. Its pretty straight forward to use this framework to get the current longitude and latitude of the place where you are with your iPhone. Here is a link which explains a step by step details for the same http://iappdevs.blog.co.in/2008/12/06/get-current-location-sample-example-iphone-programming/.

GeoNames – Once you have the geo positions, you can use Google Api’s directly to get different kinds of places around you. Although I intend to have a small weather widget and the name of the city/state you are in right now. So I used the GeoNames webservices which provide a list of probably zipcodes for a given longitude and latitude combination. Here is a link for more information about different services provided by GeoNames http://www.geonames.org/export/.

Google API’s – Now since I know your correct location (as per the webservice), I would be using google Local search API to get the nearby results for the search term entered. Google Ajax API for Local Search accepts longitude/latitude combination and a search query which returns the result in a JSON format. Here is the link for the Google API’s for local search http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje.

Of course this arises a question about how to parse the JSON result on the iPhone. Chill out! You are not alone in this world. You will find several results for JSON parsing on iPhone when searched on the net, but here is a link which helped me a lot http://iphonedevelopertips.com/cocoa/json-framework-for-iphone-part-2.html.

Facebook Connect – By now, everyone knows that Facebook has shown interests in the iPhone a lot. Facebook connect is awesome and on iPhone is even better. It is a bit flaky in some cases but most of the time, it works as it should. I am sure it ain’t difficult to get a link for this topic :), but what the heck(lazy bums), here is the link http://developers.facebook.com/connect.php?tab=iphone. Do check out the video on Facebook implementation on iPhone and you are good to go.


Happy Programming!


Post a Comment