Just upgraded to Swift 2 and using Xcode 7. Using Parse for backend.
I'm doing a normal query in background:
let query = PFQuery(className: "User")
query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
if let objects = objects as? [PFObject] {
}
}
I get error in Xcode:
Downcast from '[PFObject]?' to '[PFObject]' only unwraps optionals; did you mean to use '!'?
Any ideas how I can fix this?
Just remove as? [PFObject]
Parse Change the [AnyObject] to a [PFObject]
findObjectsInBackgroundWithBlock({(objects:[AnyObject]?, error:NSError?)
so :
findObjectsInBackgroundWithBlock { (objects, error)
The Downcast is not required
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments