Dharshini.xvalue Dharshini.xvalue - 2 months ago 12
iOS Question

Its possible to get Facebook friends list in app with latest SDK in IOS

I am trying to get friends list from Facebook to my app.Its possible in new SDK.thank you..

Answer

thanks to everyone.my working answer is here

      FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
     [login logInWithReadPermissions:@[@"email"]   handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
         {
     if (error)
     {
         // Process error
     }
     else if (result.isCancelled)
     {
         // Handle cancellations
     }
     else
     {
         if ([result.grantedPermissions containsObject:@"email"])
         {
             NSLog(@"result is:%@",result);
                      if ([FBSDKAccessToken currentAccessToken])
                   {
                 NSLog(@"Token is available : %@",[[FBSDKAccessToken currentAccessToken]tokenString]);

                 [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"id, name, link, first_name, last_name, picture.type(large), email, birthday, bio ,location ,friends ,hometown , friendlists"}]
                  startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                      if (!error)
                      {
                          NSLog(@"resultis:%@",result);
                      }
                      else
                      {
                          NSLog(@"Error %@",error);
                      }
                  }];

             }
             //[login logOut];
         }
     }
 }];
Comments