0

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,

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
Nirmalsinh Rathod
  • 5,079
  • 4
  • 26
  • 56

1 Answers1

1

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.

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90
  • Thanks Sahil :) As I read API carefully and its say Photo and Page like is not possible from API. Thanks for you help. As I tried with URL and its working perfect, but URL goes to webview for it. Anyways thanks for your help. – Nirmalsinh Rathod Apr 12 '14 at 03:38