Friday, March 2, 2012

Facebook wall post parameters

As you already know, Facebook iPhone app is the most downloaded app on iTunes AppStore and sharing contents on Facebook has become an usual requirement in iPhone apps.

To post a feed on user's wall, we need to provide a set of values in the form of dictionary.

To post a feed, we use below method of facebook class,
[facebook dialog: @"feed"
               andParams: params
             andDelegate: self];

Here, 'params' is the dictionary that contains set of values to be posted on Facebook users wall.


A typical feed may look like below,

-(void)postToFacebook{
    NSString *description = @"Nice app to see movie trailers!";
    
    NSString* propString = @"{\"Download it free: \":{\"href\":\"http://itunes.apple.com/us/app/itunes-movie-trailers/id471966214?mt=8\",\"text\":\"On iTunes AppStore\"}}";
    
    // post FB dialog
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"iTunes Movie Trailers!", @"name",                             // Bold/blue name
                                   @"www.apple.com", @"caption",                                   // 1st line
                                   description, @"description",                                    // 2nd line
                                   @"http://itunes.apple.com/us/app/itunes-movie-trailers/id471966214?mt=8", @"link",
                                   @"http://www.blogcdn.com/www.tuaw.com/media/2011/10/imovietrailersapp.jpg", @"picture",
                                   propString, @"properties",
                                   nil];
    
    [facebook dialog: @"feed"
           andParams: params
         andDelegate: self];
}

Using this, the wall post on web page will look like below,
eg. wall post

Keep integrating Facebook in your application !!!