-1

I need my APP to be able to get data on the user Facebook friends. I managed to get the id of the Facebook friends but I'm stuck on getting their data.

I found an Objective C code that supposed to get the data, the problem is that I am using swift but I don't know how to convert the Objective C code to swift.

This is the code:

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                initWithGraphPath:@"/{user-id}"
            parameters:params
            HTTPMethod:@"GET"];
            [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
            id result,
            NSError *error) {
            // Handle the result
            }];

Any suggestions.

Ritesh Sinha
  • 820
  • 5
  • 22
  • 50
Omer
  • 221
  • 3
  • 13

1 Answers1

1

The Swift version would be

var request : FBSDKGraphRequest = FBSDKGraphRequest(
    graphPath: "/{user-id}/taggable_friends",
    parameters: params, 
    HTTPMethod: "GET"
)

request.startWithCompletionHandler { (
    connection: FBSDKGraphRequestConnection!,
    result: AnyObject!,
    error:NSError!) -> Void in
    // Handle the result
}
Race B
  • 1,193
  • 1
  • 8
  • 7
  • I'm trying to get the birthday of a facebook user using his facebook id – Omer Jul 01 '15 at 15:37
  • You didn't say that. You said. "I don't know how to convert the Objective C code to swift." I did that. Maybe you should actually tell us what you are trying to do. – Race B Jul 01 '15 at 16:32
  • I'm trying to get the birthday date of a facebook user by using his ID – Omer Jul 02 '15 at 13:08