Subscribe:

Pages

Monday, January 23, 2012

Publish post with image in Facebook using my iPhone Application

         There are several ways to publish a post in Facebook. Facebook graph api allow you to access their files and work with what you want. Those third party application allow you to working with Facebook.
But in this post I try to show, how to work with Facebook using only Facebook Graph Api. Therefore no need any user agreement, no unwanted codes.

1. I create FBShare class implementing UIViewController class and UIWebViewDelegate class.


2. Declare method, property and action in header file.


3.  In this step I create an url request for get the access token to access the Facebook graph api. Facebook Graph Api will generate the key with expire time and send back to your web view. First of all you must create a new application in Facebook using Facebook Developer site. You can extend the permission like using status_update, photo_upload, share_item. According to your permission Facebook Graph Api generate separate access token.


          This is the UI of my application and you can install the application for allow to build a connection between your application and Facebook Graph Api.

4. In this step I get the response url which send by Facebook Graph Api. That's why I implement the UIWebViewDelegate class into my FBShare class.


5. Using regular expression, take the access token and its expire time.


6. Finally you can publish your image in your wall. You can add any string value for boundary.

No comments:

Post a Comment