gpt4 book ai didi

ios - 使用 Parse 时如何获取所有 Facebook 好友的列表?

转载 作者:搜寻专家 更新时间:2023-11-01 05:54:11 26 4
gpt4 key购买 nike

以下是 getFBfriends()viewDidAppear 内的代码中运行时的输出:

输出:

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

“total_count = 711”是正确的,但没有关于 friend 的数据。我在这里想念什么?认为权限是正确的。

代码:

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")
}
}

}

最佳答案

从图谱API v2.0开始,您也只能获取授权您应用的好友。结果是正确的,你的 friend 还没有授权你的应用,所以它是空的,只显示 friend 总数。

更多信息:Get ALL User Friends Using Facebook Graph API - Android

关于ios - 使用 Parse 时如何获取所有 Facebook 好友的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29466473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com