1

I am working on facebook page like without facebook like button. In my application.

i am using following code to like page from my application.

Following is page url for which i want to add like in Facebook.

NSString *likePage=@"https://www.facebook.com/pages/Shaktimantelecom/265306070277816?ref=hl"; // here you page url

Following is my FaceBookRequestConnection class to like page from my application.

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   likePage, @"object",[[NSUserDefaults standardUserDefaults] valueForKey:@"token"],@"access_token",
                                   nil];
[FBRequestConnection startWithGraphPath:@"/me/og.likes" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        UIAlertView *alert=[[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"liked with id %@",[result valueForKey:@"id"]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [alert show];
        NSLog(@"result is %@",result);
    }];

When i use the above code it gives me error as "The operation couldn't be completed (com.facebook.sdk error 5)".

Please help and tell if i am doing any thing wrong.

Note: I am using Facebook sdk.
Vinodh
  • 5,262
  • 4
  • 38
  • 68
Hrushikesh Betai
  • 2,227
  • 5
  • 33
  • 63
  • http://stackoverflow.com/a/13264711/1059705 and http://stackoverflow.com/q/13496007/1059705 might be helpful – Bala Jul 09 '13 at 07:55
  • The `og` in the action name stands for Open Graph - you can only like Open Graph objects (URLs outside of Facebook) with this, not Facebook pages. – CBroe Jul 09 '13 at 08:46
  • @CBroe i tryed it but now its give me id result as null. – Hrushikesh Betai Jul 09 '13 at 09:08

0 Answers0