Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using 'Like' with the Facebook Graph API on iOS

I am using the latest Facebook SDK for iOS and Graph API. Works Great.

I'm trying to 'Like' status updates, doing the following:

NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];
NSString *messageID = (NSString*)[managedObject valueForKey:@"message_id"];

NSLog(@"Like: %@", [NSString stringWithFormat:@"%@/likes", messageID]);

[facebook requestWithGraphPath:[NSString stringWithFormat:@"%@/likes", messageID] andParams:nil andHttpMethod:@"POST" andDelegate:self];

However this returns an error from Facebook:

facebookErrDomain error 10000.

Anyone know why this is?

like image 725
mootymoots Avatar asked Mar 12 '11 09:03

mootymoots


People also ask

What is Facebook SDK for iOS?

The Facebook SDK enables: Facebook Login - Authenticate people with their Facebook credentials. Share and Send dialogs - Enable sharing content from your app to Facebook. App Events - Log events in your application.

Is Facebook Graph API deprecated?

API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.


1 Answers

Figured it out. You cannot pass nil to the parameters. So I created an empty NSMutableDictionary, and passed that. Worked fine. (By the way: it’s not possible to like a page this way.)

like image 69
mootymoots Avatar answered Oct 15 '22 01:10

mootymoots