Search code examples
iosfacebook-graph-apiinboxfacebook-graph-api-v2.3

Reading Mailbox or user nodes through iOS app


Why this code gives error in fetching inbox

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                              initWithGraphPath:@"/me/inbox"
                              parameters:@{@"fields":@"inbox"}
                              HTTPMethod:@"GET"];

Error I get on console :

{
    code = 100;
    message = "You can only access the \"inbox\" connection for the current user.";
}

where as if If I use this code to fetch inbox it fetches me the inbox:

FBSDKGraphRequest *request =[[FBSDKGraphRequest alloc] initWithGraphPath:@"me"
                                                          parameters:@{ @"fields" : @"inbox"}];

Solution

  • Figured out can not pass fields in param

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:@"/me/inbox?limit=50"
                                  parameters:nil    
                                  HTTPMethod:@"GET"];