我有此代码:
import FacebookCore
let connection = GraphRequestConnection()
connection.add(GraphRequest(graphPath: "/me")) { httpResponse, result in
switch result {
case .success(let response):
print("Graph Request Succeeded: \(response)")
case .failed(let error):
print("Graph Request Failed: \(error)")
}
}
connection.start()
成功登录后执行哪个操作。现在我得到的只是基本信息,例如名称或ID。
仍然,我需要性别和电子邮件...所以我尝试了此操作:
let params = ["fields": "id, name, gender, email"]
然后:
connection.add(GraphRequest(graphPath: "/me", parameters: params)) { httpResponse, result in
不过,我得到的数据是相同的,响应中只有id
和name
。