I'm new to swift and Xcode, so I apologize if this is a poorly asked question. I'm working on a project with a friend and when I clone the project a few of the parse framework's aren't pulled down onto my machine, which I now believe I know why. He then sent me those frameworks. Now when I reboot the project I get 7 errors that are all related to what I think is a parse-caused problem. the error I get on all 7 of the errors is:
([PFObject]?, NSError)? Void' to expected argument type 'PFArrayResultBlock?
It is referencing line 4 in this code
@IBAction func deleteSubjectButton(sender: AnyObject) {
let query = PFQuery(className: "newKnowledge")
query.whereKey("subject", equalTo: (incomingHeader))
query.findObjectsInBackgroundWithBlock({ (objects : [PFObject]?, error: NSError?) -> Void in
if error == nil {
for object in objects! {
object.deleteInBackground()
}
}
})
}
I'd really appreciate help solving this error. He has no idea why it's happening, and it isn't happening on his machine.
This is happening to me as well with my Xcode 7.1.1. I'm guessing it is being up-to-date that is causing this bug on just one machine.
The solution is to change the line to this:
query.findObjectsInBackgroundWithBlock {(objects : [AnyObject]?, error: NSError?)-> Void in
Notice I changed PFObject to AnyObject.
Update for swift3 :
let query = PFQuery(className: "newKnowledge")
query.findObjectsInBackground(block: { (objects : [PFObject]?, error: Error?) -> Void in
if error == nil {
for object in objects! {
object.deleteInBackground()
}
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With