0

I am trying to get facebook friends list through social framework.

- (void)getfriends {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [accountStore
                                       accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *emailReadPermisson = @{
                                     ACFacebookAppIdKey : @"1537296106498495",
                                     ACFacebookPermissionsKey : @[@"user_friends"],
                                     ACFacebookAudienceKey : ACFacebookAudienceEveryone,
                                     };
[accountStore requestAccessToAccountsWithType:facebookAccountType options:emailReadPermisson completion:^(BOOL granted, NSError *error) {

    if (granted) {

        NSArray *accounts = [accountStore
                             accountsWithAccountType:facebookAccountType];
_facebookAccount = [accounts lastObject];

NSString *acessToken = [NSString stringWithFormat:@"%@",_facebookAccount.credential.oauthToken];
NSDictionary *parameters = @{@"access_token": acessToken};
NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/me/friends"];
SLRequest *feedRequest = [SLRequest
                          requestForServiceType:SLServiceTypeFacebook
                          requestMethod:SLRequestMethodGET
                          URL:feedURL
                          parameters:parameters];
feedRequest.account = _facebookAccount;
[feedRequest performRequestWithHandler:^(NSData *responseData,
                                         NSHTTPURLResponse *urlResponse, NSError *error)
 {
     NSLog(@"%@",[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
 }];
    }
}];
}

But data field in the response is empty. My response is:

2014-08-06 18:09:11.459 Social[5246:1303] {"data":[],"summary":{"total_count":1115}}

Jossy Paul
  • 1,267
  • 14
  • 26

0 Answers0