How to Like in Facebook using FacebookSDK.framework Facebook

I have used FacebookSDK.framework for Facebook integration in my application. I have to like one facebook page from application. I have used following code for liking page.

   NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:@"https://www.facebook.com/demoappname"
                            , @"object",
                            nil
                            ];
    /* make the API call */
    [FBRequestConnection startWithGraphPath:@"me/og.likes"
                                 parameters:params
                                 HTTPMethod:@"POST"
                          completionHandler:^(
                                              FBRequestConnection *connection,
                                              id result,
                                              NSError *error
                                              )
    {

        NSDictionary *currentResult= [(NSArray *)[result data] objectAtIndex:0];

        if(!error)
        {
            NSLog(@"there is no error");
        }
        else
        {
            NSLog(@"There is something wrong at here.");
        }
    }];

But I am not clear what I have to pass in "object" parameter. Can anybody help to what I am doing wrong at here.

Thanks,

Answers


If you read this documentation, it says-

The og.likes action can refer to any open graph object or URL, except for Facebook Pages or Photos.

So, liking a page with Graph API isn't possible.

The only thing you can do- add a Like Button to the page in your app.


Need Your Help

JQuery Validation Plugin: Use remote with delay

php jquery ajax validation

I am using the remote method from the jQuery validation plugin which makes an ajax call. The remote function is activated each time a key is pressed in the input field. I would like to add a delay,...