How to get Friends list from Facebook iOS sdk
https://developers.facebook.com/docs/apps/changelog
Since v2.0 you cannot get the full friend list anymore, you only get the friends who authorized your App too.
See my answer in this thread too: how to get a list of all user friends (not only who use the app)?
Facebook iOS SDK - get friends list in Graph API v2.4
You have to add permission at login time user_friends
A user access token with user_friends
permission is required to view any of that person's friend lists.
you can get only that friends who installed the same apps,
Only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app.
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"me/friends"
parameters:nil
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Its possible to get Facebook friends list in app with latest SDK in IOS
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];
}
}
}];
Facebook Get friends list
From the Facebook SDK page, it looks like /me/friends will only return your friends that have logged in and given permission to the same app (i.e. you and your friends need to have permitted your app to use facebook via login).
Get All friend list from Facebook using Facebook SDK 4.20 iOS]
It is not possible with Graph Api
me/friends
returns friends who already use your app.
me/taggable_friends
returns friends that can be tagged in content published.
me/invitable_friends
This edge is only available to Games (including Gameroom), and requires the user_friends permission. its return a inevitable friends for game
More Info Here and Here
Get Facebook friends list in Swift
Here is what I ended up doing. Unlike the first 2 permissions, I had to make a separate request to get the friends:
FBRequestConnection.startForMyFriendsWithCompletionHandler({ (connection, result, error: NSError!) -> Void in
if error == nil {
var friendObjects = result["data"] as [NSDictionary]
for friendObject in friendObjects {
println(friendObject["id"] as NSString)
}
println("\(friendObjects.count)")
} else {
println("Error requesting friends list form facebook")
println("\(error)")
}
})
Related Topics
Calculate Uitableviewcell Height to Fit String
Iphone: Can a Dev Other Than Team Agent Build an App for Distribution
How to Make Uibutton's Text Alignment Center? Using Ib
How to Add Private Key to the Distribution Certificate
iOS How to Asynchronously Download and Cache Images and Videos for Use in My App
How to Add Live Camera Preview to Uiview
Sensitivity/Scroll Speed of Uiscrollview with Paging
Using Global Variables in Objective-C
Ios: Present View Controller Programmatically
Where Does the Indexpath of Dequeuereusablecellwithidentifier:Forindexpath: Get Used
Retrieve User Defaults Information from an Apple Watch
How to Pretty Print Swift Dictionaries to the Console
How to Convert Nsinteger to Nsstring Datatype
Using iOS Gamekit's "Bluetooth Bonjour" with Other Platforms
How to Get All Enum Values as an Array
Creating a 3X3 Grid with Auto Layout Constraints
What Does Warning "Mapping Architecture Arm64 to X86_64" Mean