Parse-server: Parse issue in Swift 3

Created on 16 Sep 2016  路  3Comments  路  Source: parse-community/parse-server

Hi, I setup my parse solution using Swift 2. After updating Xcode and converting to Swift 3 I get the following error on my code:

let query = PFQuery(className: "gameScore")

    query.order(byDescending: "score")
    query.findObjectsInBackgroundWithBlock {(objects: [PFObject]?, error: NSError?) -> Void in

Cannot convert value of type '([PFObject]?, NSError?) -Z Void' to expected argument type '([PFObject]?, NSError?) -> Void?

Anyone with any ideas on this issue??
Thanks!

Most helpful comment

Try replacing error: NSError? with error: Error?.

All 3 comments

Try replacing error: NSError? with error: Error?.

Awesome! This was the key to solve it!

Glad I could help :-) I suggest you post general questions regarding code migration to Swift 3 on Stackoverflow where you have a great developer community helping you out.

If you think you found a bug in parse server, have any feature suggestions or want to contribute to parse server code then this here is the place to go.

Was this page helpful?
0 / 5 - 0 ratings