title: iOS Facebook get friends list
body: <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      m_allFriends = [[NSMutableArray alloc] init];
  
  
      if ([[FBSession activeSession] isOpen])
      {
          if ([[[FBSession activeSession] permissions]indexOfObject:@"user_friends"] == NSNotFound)
          {
  
              [[FBSession activeSession] requestNewPublishPermissions:[NSArray arrayWithObject:@"user_friends"] defaultAudience:FBSessionDefaultAudienceFriends
                                                    completionHandler:^(FBSession *session,NSError *error){
                                                        [self getFBFriendListFunc];
                                                        NSLog(@"1");
                                                    }];
  
          }
          else
          {
              [self getFBFriendListFunc];
              NSLog(@"2");
          }
      }
      else
      {
  
          [FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObject:@"user_friends"]
                                             defaultAudience:FBSessionDefaultAudienceOnlyMe
                                                allowLoginUI:YES
                                           completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
                                               if (!error &amp;&amp; status == FBSessionStateOpen) {
                                                   [self getFBFriendListFunc];
                                                   NSLog(@"3");
                                               }else{
                                                   NSLog(@"error");
                                               }
                                           }];
      }
  
  }
  
  
  -(void)getFBFriendListFunc
  {
      [FBRequestConnection startWithGraphPath:@"me/friends"
                                   parameters:nil
                                   HTTPMethod:@"GET"
                            completionHandler:^(
                                                FBRequestConnection *connection,
                                                id result,
                                                NSError *error
                                                ) {
                                NSLog(@"me/friends result=%@",result);
  
                                NSLog(@"me/friends error = %@", error.description);
  
                                NSArray *friendList = [result objectForKey:@"data"];
  
                                [m_allFriends addObjectsFromArray: friendList];
                            }];
  
  }
  </code></pre>
  
  <p>I try to connect Facebook with their API, actually this code connect Facebook, Facebook ask me this application want to use your information than i confirmed. Last step, Facebook return again my application than this <code>getFBFriendListFunc</code> should be run but none of if/else work. Nothing display...</p>
  
  <p>I get this codes on Facebook developer which code part wrong ? 
  Any idea ?
  Thank you...</p>