benhi
benhi

Reputation: 582

Facebook sdk 2.4 how to get events from user?

I try to get the events of user. after the login I ask the user id with the following code:

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

     NSLog(@"ID: %@", result[@"id"]);

     NSString *str = [NSString stringWithFormat:@"%@/events",result[@"id"]];

     FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                   initWithGraphPath:str
                                   parameters:nil
                                   HTTPMethod:@"GET"];
     [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                           id result,
                                           NSError *error) {

         // Handle the result

     }];


 }];

The result is empty although in the graph api explorer I get the data!!

Thanks

Upvotes: 1

Views: 426

Answers (1)

Viraj Padsala
Viraj Padsala

Reputation: 1398

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/events" parameters:nil]

Instead of "me" use "me/events" to get user events......

Upvotes: 6

Related Questions