无法从 swift 中的 json 数据检索 Facebook 好友列表

Trouble retrieving list of facebook friends from json data in swift

我在我的 Swift iOS 应用程序中使用 FBSDK,目前我正在尝试检索 也使用我的应用程序的朋友列表。 我有两三个人应该出现,但每当我搜索朋友的 graphrequest 结果时,它 returns nil..

let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me",     parameters: nil)
        graphRequest.startWithCompletionHandler({ (connection,     result:AnyObject!, error) -> Void in

            if ((error) != nil)
            {
                // Process error
                println("Error: \(error)")
            }
            else
            {
                //get Facebook ID
                let faceBookID: NSString = result.valueForKey("id") as NSString
                //get username
                let userName : NSString = result.valueForKey("name") as NSString
                //get facebook friends who use app
                let friendlist: AnyObject = result.valueForKey("friends") as AnyObject

            }

我拥有 "email"、"user_friends" 和 "public_profile" 权限,应该足以检索此信息。关于我做错了什么的任何想法?这是我的头脑,因为我的朋友在做 android 版本已经成功地开始工作了..

In v2.0 of the Graph API, you must request the user_friends permission from each user. user_friends is no longer included by default in every login. Each user must grant the user_friends permission in order to appear in the response to /me/friends.

看这里:https://developers.facebook.com/bugs/1502515636638396/

我的问题是我从来没有真正在我的 facebook 图形请求中请求过朋友列表...

替换后 FBSDKGraphRequest(graphPath: "me", parameters: nil)

FBSDKGraphRequest(graphPath: "me?fields=id,name,friends", parameters: nil)

我能够检索到朋友列表,因为响应实际上包含了这方面的信息。我犯了一个非常小的错误。