Swift:如何更新布尔值解析
Swift: how to update boolean value parse
我没有那么多经验所以解释时请友善
我无法通过 swift.
更新我的布尔值
let parseQuery = PFQuery(className: "request")
parseQuery.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
if let objects = objects {
for object in objects {
object.setValue(false, forKey: "isRead") //tried this and didn't work
object["isRead"] = false //tried this and didn't work as well..
}
}
}
我用来更新我的布尔值的方法是错误的?
您需要设置对象的 ACL。将对象保存到 Parse 时,写这样的东西
object.ACL.setPublicWriteAccess(true)
对于现有对象,进入 class 并向右滚动到 ACL。然后将 public 写入权限设置为 true。希望这可以帮助。
您在更新对象后从未保存过它们。
别忘了最终保存()
object["isRead"] = NSNumber(bool: false)
object.saveEventually()
我没有那么多经验所以解释时请友善
我无法通过 swift.
更新我的布尔值 let parseQuery = PFQuery(className: "request")
parseQuery.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
if let objects = objects {
for object in objects {
object.setValue(false, forKey: "isRead") //tried this and didn't work
object["isRead"] = false //tried this and didn't work as well..
}
}
}
我用来更新我的布尔值的方法是错误的?
您需要设置对象的 ACL。将对象保存到 Parse 时,写这样的东西
object.ACL.setPublicWriteAccess(true)
对于现有对象,进入 class 并向右滚动到 ACL。然后将 public 写入权限设置为 true。希望这可以帮助。
您在更新对象后从未保存过它们。
别忘了最终保存()
object["isRead"] = NSNumber(bool: false)
object.saveEventually()