Following is the output when getFBfriends() is run in the code inside viewDidAppear below:
Output:
Result Dict: {
data = (
);
summary = {
"total_count" = 711;
};
}
Found 0 friends
The "total_count = 711" is correct but there is not data about the friends. What I am I missing here? Think the permissions are correct.
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")
}
}
}
Your permissions are correct, but try to login your app using another fb account you will get that user details in your data response.