iosfacebookfbsdkloginkit

How can i get work and age from Facebook iOS API


I am trying to get some data from Facebook and I am able to get is:

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{ @"fields" : @"id,name,first_name,last_name,picture.width(300).height(300),gender,birthday"}]startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

NSString *nameOfLoginUser = [result valueForKey:@"name"];
                fNameUser = [result valueForKey:@"first_name"];
                lNameUser = [result valueForKey:@"last_name"];
                genderUser = [result valueForKey:@"gender"];
                ageUser = [result valueForKey:@"birthday"];

                NSString *imageStringOfLoginUser = [[[result valueForKey:@"picture"] valueForKey:@"data"] valueForKey:@"url"];
}

how can I get "age" and "work at" from API.


Solution

  • You can't get age as you can access birthday and there is no paramter related age ... so you need to calculate age according to birthday ..

    For work: you can access work only after reviewing your app.

    If your app requests this(work) permission Facebook will have to review how your app uses it.

    For more datail check out this doc.