我想以更新類「currentUploads」在解析列: Image here更新在解析班列的值
這是我想
@IBAction func reportButtonAction(sender: AnyObject) {
println("Report Button Pressed")
let buttonPosition = sender.convertPoint(CGPointZero, toView: self.collectionView)
let indexPath = self.collectionView.indexPathForItemAtPoint(buttonPosition)
var alertMessage = NSString(format: "*User: %@\r *Text: %@\r *Created at %@", imageUploader[indexPath!.row], imageText[indexPath!.row]/*, imageCreated[indexPath!.row]*/)
var reportAlert = UIAlertController(title: "Report Content", message:alertMessage as String, preferredStyle: UIAlertControllerStyle.Alert)
reportAlert.addAction(UIAlertAction(title: "Yes", style: .Default, handler: { (action: UIAlertAction!) in
println("Handle Report Logic here")
self.reportContent()
}))
reportAlert.addAction(UIAlertAction(title: "Cancel", style: .Default, handler: { (action: UIAlertAction!) in
println("Handle Cancel Logic here")
}))
presentViewController(reportAlert, animated: true, completion: nil)
}
func reportContent(){
let someQuery = PFQuery(className: "currentUploads")
someQuery.getObjectInBackgroundWithId("imageFile") {
(updatedObject: PFObject?, error: NSError?) -> Void in
if error != nil {
print(error)
} else if let updatedObject = updatedObject {
updatedObject["reportedCount"] = "1"
updatedObject.saveInBackground()
}
}
}
所以我想更新/遞增「reportedCount」 1在func reportContent
選定的圖像,但我得到這個錯誤:
[Error]: No results matched the query. (Code: 101, Version: 1.8.0) Optional(Error Domain=Parse Code=101 "No results matched the query." UserInfo=0x7fae8a484aa0 {error=No results matched the query., NSLocalizedDescription=No results matched the query., code=101})
我做錯了什麼? - http://s30.postimg.org/rkjj17erl/Screen_Shot_2015_10_19_at_19_11_51.png – IdaEmilie
試過這個,不知道爲什麼它不起作用:http://pastebin.com/hRwFSMaT – IdaEmilie