Reputation: 197
I want to access friend list from facebook account, the proble is that the friend list is accessed in simulatore but not in device, so what i have to do about this??
Thanks...
FBRequest* friendsRequest = [FBRequest requestForMyFriends];
friendsRequest.session = FBSession.activeSession;
[friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
NSDictionary* result,
NSError *error) {
NSArray* friends = [result objectForKey:@"data"];
NSLog(@"Found: %lu friends", (unsigned long)friends.count);
for (NSDictionary<FBGraphUser>* friend in friends)
{
NSLog(@"I have a friend named %@ ", friend.name);
}
}];
Upvotes: 1
Views: 78
Reputation: 2693
Try this..
@property (nonatomic, strong) FBRequestConnection *connection;
-(void)requestAllFreindsWithHandler:(FBRequestHandler)handler;
{
NSAssert([FBSession activeSession] != nil, @"Login required ");
self.connection = [FBRequestConnection startForMyFriendsWithCompletionHandler:handler];
}
Upvotes: 2