我想从Facebook帐户中获取所有照片。但我无法取得它。每当我要求我得到空阵列。
@IBAction func shareFacebook(sender: FBSDKLoginButton) {
sender.readPermissions = ["public_profile", "email", "user_friends"]
sender.delegate = self
sender.loginBehavior = .Native
}
//Delegate Method
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!)
{
print(result.token)
FBSDKGraphRequest.init(graphPath: "me/photos", parameters: ["fields":"age_range,name,first_name, last_name, picture.type(large)"], HTTPMethod: "get").startWithCompletionHandler { (con, res, err) in
print(res)
}
}
//Output = <FBSDKAccessToken: 0x12fea99a0>
{
data = (
);
}
答案 0 :(得分:1)
/me/photos
需要权限user_photos
。确保您使用该权限授权用户:
sender.readPermissions = ["public_profile", "email", "user_friends", "user_photos"]
如果仍然无效,请确保您尝试作为App Admin并阅读有关登录评论的信息:https://developers.facebook.com/docs/facebook-login/review
此外,/me/photos
端点没有age_range
,name
,first_name
等字段。那只是/me
端点。
答案 1 :(得分:0)
emilia_clarke