问题
I have two Facebook accounts(friends) and I logged in and authorized my app in both. But when I try to request friends from any of them I get an empty list. Can this be related to the fact that my app still in development?
granted permissions = [AnyHashable("user_friends"), AnyHashable("contact_email"), AnyHashable("email"), AnyHashable("public_profile"), AnyHashable("user_birthday")]
my code:
FBSDKGraphRequest(graphPath: "/me/friends", parameters: nil).start(completionHandler: { (connection, user, requestError) -> Void in
let userData = user as! NSDictionary
let friends = userData["data"] as? String
if requestError != nil {
print(requestError)
return
}
print(friends) // prints nil
})
Im using Swift 3
回答1:
let friends = userData["data"] as? [NSDictionary]
来源:https://stackoverflow.com/questions/40064887/request-facebook-friends-return-empty