我希望用户上传图片,其他用户留下对该图片的回复,一切正常如此肥胖,除非我无法保存回复"回复" Parse中的对象/列进入我的本地数组以显示它们。它无法接受:for in
方法。
override func viewDidLoad() {
super.viewDidLoad()
var query = PFQuery(className:"Posts")
query.getObjectInBackgroundWithId(cellID) {
(objects: PFObject!, error: NSError!) -> Void in
if error == nil {
println(objects["replies"])
self.repliesArray.append(objects["replies"] as String) // <- problem Here
} else {
println("Error retreiving")
self.displayError("Error", error: "Error retrieving")
}
}
}
答案 0 :(得分:1)
如果回复列是字符串,请尝试:
if error == nil {
var array = objects.objectForKey("replies") as [String]
for obj in array {
self.repliesArray.append(obj as String)
}
}