Facebook iOS SDK - get friends list

后端 未结 11 1449
猫巷女王i
猫巷女王i 2020-12-07 12:41

Using the Facebook iOS SDK, how can I get an NSArray of all my friends and send them an invitation to my app? I am specifically looking for the graph path to ge

11条回答
  •  春和景丽
    2020-12-07 12:54

    -(void)getFBFriends{
    
        NSDictionary *queryParam =
        [NSDictionary dictionaryWithObjectsAndKeys:@"SELECT uid, sex,name,hometown_location,birthday, pic_square,pic_big FROM user WHERE uid = me()"
         @"OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())", @"q", nil];
        // Make the API request that uses FQL
        [FBRequestConnection startWithGraphPath:@"/fql"
                                     parameters:queryParam
                                     HTTPMethod:@"GET"
                              completionHandler:^(FBRequestConnection *connection,
                                                  id result,
                                                  NSError *error) {
                                  if (error) {                                  
                                      NSLog(@"Error: %@", [error localizedDescription]);
                                  } else {
                                      NSDictionary *data=result;
                                      //NSLog(@"the returned data of user is %@",data);
                                      NSArray *dataArray=[data objectForKey:@"data"];
                                    //dataArray contains first user as self user and your friend list
    
                                  }
                              }];
    }
    

提交回复
热议问题