How to get a list of all Facebook friends when using Parse?

The following is the result when getFBfriends () is run in code inside viewDidAppear below:

Output:

Result Dict: { data = ( ); summary = { "total_count" = 711; }; } Found 0 friends 

"total_count = 711" is correct, but there is no friend data. What am I missing here? Think that the rights are right.

the code:

 class SignUpViewController: UIViewController { @IBOutlet weak var btn_signIn: UIButton! @IBAction func action_btnSignIn(sender: AnyObject) { var permissions = ["public_profile", "user_friends"] println("in action_btnSignIn() of SignUpViewController") var fbloginView:FBLoginView = FBLoginView(readPermissions: ["email", "public_profile", "user_friends"]) override func viewDidAppear(animated: Bool) { if PFUser.currentUser() != nil { println("User logged in, so launching Menu Screen") //self.performSegueWithIdentifier("launchmenu", sender: self) getDBfriends() } else { println("User NOT logged in") } } func getDBfriends() { var friendsRequest: FBRequest = FBRequest.requestForMyFriends() friendsRequest.startWithCompletionHandler{(connection:FBRequestConnection!, result:AnyObject!, error:NSError!) -> Void in var resultdict = result as NSDictionary println("Result Dict: \(resultdict)") var data : NSArray = resultdict.objectForKey("data") as NSArray for i in 0..<data.count { let valueDict : NSDictionary = data[i] as NSDictionary let id = valueDict.objectForKey("id") as String println("the id value is \(id)") } var friends = resultdict.objectForKey("data") as NSArray println("Found \(friends.count) friends") } } } 
+1
ios swift facebook-ios-sdk
source share
2 answers

Your permissions are correct, but try logging into your application using a different fb account and you will get this user's data in the response of your data.

+3
source share

Since v2.0 is the Graph API, you can only get friends who have approved your application as well. The result is correct, none of your friends has allowed your application, but it is empty and shows the total number of friends.

Additional Information: Get ALL user friends using the Facebook API - Android

+4
source share

All Articles