更新时间:2023-12-04 10:09:40
根据新的Facebook SDK,您必须使用 FBSDKGraphRequest
As per the new Facebook SDK, you must have to pass the parameters with the FBSDKGraphRequest
if((FBSDKAccessToken.currentAccessToken()) != nil){
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, email"]).startWithCompletionHandler({ (connection, result, error) -> Void in
if (error == nil){
println(result)
}
})
}
文件链接: https://developers.facebook.com/docs/facebook-login/permissions/v2.4
用户对象参考: https://developers.facebook.com/docs/graph-api/reference/user
使用公开个人资料,您可以获得性别:
With public profile you can get gender :
public_profile (Default)
Provides access to a subset of items that are part of a person's public profile. A person's public profile refers to the following properties on the user object by default:
id
name
first_name
last_name
age_range
link
gender
locale
timezone
updated_time
verified