这就是我如何使用objectId
检索用户信息:
func loadData() {
userId = toPass
data.removeAllObjects()
var profileQuery:PFQuery = PFUser.query()!
profileQuery.whereKey("objectId", equalTo: userId)
profileQuery.getObjectInBackgroundWithId(userId, block: { (objects, error) -> Void in
if error == nil {
self.data.addObject(objects!)
println(self.data) //...shouldn't be empty here
} else {
println("Error retrieving user: \(error) ")
}
})
}
override func viewDidLoad() {
super.viewDidLoad()
loadData()
fullName.text = self.data["fullName"] as! String! // ***** error here.. cannot assign a value of type 'String' to a value of type 'String?'
}
viewDidLoad 中出现错误..知道我哪里错了吗?感谢您抽出时间。
最佳答案
data 是一个 parseobjects 数组,您想从中读取 parseobject 属性...迭代数组或从中获取特定索引号,然后从中加载“fullname”属性或使用 getFirstObject...方法
关于ios - 从解析中检索数据并在 viewController 中使用它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32221842/