Im trying to get the user's likes from Facebook, I've been looking for a while for an example and I didn't find it. With the code I have I get the user's profile information, but no likes. I was wondering if I was doing something wrong and then I looked at Facebook Developers and I found this https://developers.facebook.com/docs/ios/user-data-ios-sdk/
If you take a look at the JSON that is returned you won't see any likes, so what does that mean? There's no way to fech the likes of a user? Why even bother calling the permission "user_likes"?
Any direction will be very appreciated.
Thanks.
Well, let's put it this way. Facebook documentation is confusing. To get he user likes you have to use FQL, the snippet, would be something like this.
// Query to fetch the active user's friends, limit to 25.
NSString *query =
@"SELECT page_id, type FROM page_fan WHERE uid = me()";
// Set up the query parameter
NSDictionary *queryParam = @{ @"q": query };
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
This way you are getting the users Pages id. If you need something else, take a look at the documentation here: https://developers.facebook.com/docs/reference/fql/page_fan