简体   繁体   中英

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?

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 .)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM