我正在尝试使用 FBSDKGraphRequest 填充文本字段。名字/姓氏和电子邮件不是问题,但说到位置,我似乎只能得到“德克萨斯州奥斯汀”。我似乎无法将单个值取出并放入 textFields。
在下面的代码中,城市文本字段填充了“德克萨斯州奥斯汀”。我怎么能得到'奥斯汀'城市,然后在状态文本字段中得到'德克萨斯'?
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "email, first_name, last_name, location"]).start(completionHandler: { (connection, result, error) -> Void in
if let error = error {
self.alertTheUser(title: "Error", message: error.localizedDescription)
print(error)
}else{
let fbDetails = result as! NSDictionary
let location : NSDictionary! = fbDetails.value(forKey: "location") as! NSDictionary
print(fbDetails)
self.registerEmailField.text = fbDetails.value(forKey: "email") as? String
self.registerFirstNameField.text = fbDetails.value(forKey: "first_name") as? String
self.registerLastNameField.text = fbDetails.value(forKey: "last_name") as? String
self.registerCityField.text = location.value(forKey: "name") as? String
}
})