0

My app is recieving a error when making a GET Request to the Facebook API for the endpoint me.

Here is my code:

-(void) updateUserInformation{
    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me:" parameters:@{@"fields": @"id, name, email, user_birthday"}];

    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        if(!error){
            NSDictionary *userDictionary = (NSDictionary *)result;
            NSMutableDictionary *userProfile = [[NSMutableDictionary alloc] initWithCapacity:8];

            if (userDictionary[@"name"]) {
                userProfile[@"name"] = userDictionary[@"name"];
            }

            if (userDictionary[@"first_name"]) {
                userProfile[@"first_name"] = userDictionary[@"first_name"];
            }

            if (userDictionary[@"location"][@"name"]) {
                userProfile[@"location"] = userDictionary[@"location"][@"name"];
            }

            if (userDictionary[@"gender"]) {
                userProfile[@"gender"] = userDictionary[@"gender"];
            }

            if (userDictionary[@"birthday"]) {
                userProfile[@"birthday"] = userDictionary[@"birthday"];
            }
            if (userDictionary[@"interested_in"]) {
                userProfile[@"interested_in"] = userDictionary[@"interested_in"];
            }

            [[PFUser currentUser] setObject:userProfile forKey:@"profile"];

            [[PFUser currentUser] saveInBackground];

        }else {
            NSLog(@"Error in Facebook Request %@", error);
        }

    }];
}

There error that I am getting is:

2015-10-11 14:30:59.306 MatchedUp[2358:139193] Error in Facebook Request Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=803, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 803;
            "fbtrace_id" = "CfGbwnx4/B9";
            message = "(#803) Some of the aliases you requested do not exist: me:";
            type = OAuthException;
        };
    };
    code = 404;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=404, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#803) Some of the aliases you requested do not exist: me:, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0}

I am not very sure what this error means. It says "Some of the aliases you requested do not exist: me:" does that mean the result dictionary in the completionHandler does not contain some of the information for the endpoint me? Any help would be appreciated. Thank you!

1 Answers1

0

Try changing your graph path @"/me:" to just @"me".

Good luck!

adamsuskin
  • 547
  • 3
  • 16
  • OMG Thank you so much!!! I can't believe it was such a simple mistake haha... Sometimes it just takes another pair of eyes to catch these errors :) –  Oct 11 '15 at 21:58
  • Do you happen to know how I can get more information about the user? I am only getting the name and id in the result that is passed back in the completion handler. I would also like the email, birthday, gender, interested in, etc. –  Oct 11 '15 at 22:01
  • @1290: You need to ask for additional fields, see http://stackoverflow.com/a/32585470/1427878 – CBroe Oct 12 '15 at 07:48
  • @CBroe The stackoverflow post you provided is for a web application I believe? Does it work the same way for an iPhone app? Since on the Facebook docs it stated that I need to get extra permissions from Facebook and ask them if I can recieve access to certain permissions. –  Oct 18 '15 at 17:59
  • Of course you need to get the permissions first, what platform your app is on doesn’t change that. And neither does it change that you need to ask for those additional fields now specifically. – CBroe Oct 18 '15 at 18:37