如何访问 PFObject 中的信息?
How do I gain access to the info inside a PFObject?
我正在从解析中导入对象,但我需要访问其中的信息。该对象具有用户的姓名和地址,我需要获取这些信息。我该怎么做?
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 的正确语法。
只需创建一个循环来访问单个对象,然后像下面这样获取值:
for Oneobject in objects
{
let strAddress = Oneobject["address"] as String
let strName = Oneobject["name"] as String
}
参考以下内容link:
https://parse.com/docs/ios/guide#objects-retrieving-objects
我正在从解析中导入对象,但我需要访问其中的信息。该对象具有用户的姓名和地址,我需要获取这些信息。我该怎么做?
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 的正确语法。
只需创建一个循环来访问单个对象,然后像下面这样获取值:
for Oneobject in objects
{
let strAddress = Oneobject["address"] as String
let strName = Oneobject["name"] as String
}
参考以下内容link: https://parse.com/docs/ios/guide#objects-retrieving-objects