我从parse导入对象,但我需要访问其中的信息。该对象具有用户的名称和地址,我需要获取这些。我该怎么做?
let query = PFQuery(className: "People")
query.findObjectsInBackgroundWithBlock { (objects: [PFObject]?, error: NSError?) in
if(error == nil){
for object in objects!{
self.peopleObj.append(object)
}
}else{
print(error)
}
}
我会做peopleObj["Name"]
这样的事情,我不认为这是PFObject的正确语法。
答案 0 :(得分:1)
只需循环访问单个对象,然后获取如下所示的值:
for Oneobject in objects
{
let strAddress = Oneobject["address"] as String
let strName = Oneobject["name"] as String
}
请参阅以下链接: https://parse.com/docs/ios/guide#objects-retrieving-objects