0

I've been looking through the open grpah reference docs, and can't seem to find a good example related to SLRequest regarding users and whether they like a certain page or not. I don't want to iterate through their entire list of likes.

I was looking at https://developers.facebook.com/docs/graph-api/reference/user/likes/ but I'm not sure how to work with it and SLRequest, I've done the following but I'm receiving the following response:

Received Response: {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}

Thing is all of this code only runs if the suer has previously authenticated and granted permission, and so it must have found an account, yet I still get this respond. Could it be that I'm not requesting a specific permission? I've requested, "email, public_actions, user_likes and public_stream".

BTW I do have another view controller where I ask for these permissions (except user_likes), and everything works in that one. Is there anything that I'm missing here? Thanks!

NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/me/likes/{MYPAGEID}"];
[SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:feedURL parameters:nil];
[updateFeedRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (responseData ) {
   NSLog(@"Received Response: %@", [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
   if (urlResponse.statusCode >= 200 && urlResponse.statusCode < 300) {
      NSLog(@"Successful Connection");
   } else {
   }
} else {
     NSLog(@"No response.");
  }
}];
KingPolygon
  • 4,753
  • 7
  • 43
  • 72

1 Answers1

0

The error that you are getting is received when you try to make calls like /me but no user is currently logged-in to your app or the user has already logged-out of the app.

I'm not sure of your complete flow of the app but you can try this to validate your access token and call- you have the access token right? so, with your current API call just add an extra parameter access_token with its value.

Sahil Mittal
  • 20,697
  • 12
  • 65
  • 90