转换为swift 3后,解析saveInBackground无法正常工作

Dav*_*gas 2 xcode parse-platform swift swift3

我最近更新了我的解析的项目到今天迅速3和我的沮丧不是单一的saveInBackgroundWithBlock,getDataInBackground,findObjectsInBackGround etc工作.-______-这是一个不起作用的部分示例:

newCart.saveInBackground { (saved:Bool, error:NSError?) -> Void in
            if saved {
                print("saved worked")
            } else {
                print(error)
            }
        }
Run Code Online (Sandbox Code Playgroud)

Dav*_*gas 7

因此经过一些快速的研究后,我发现,简而言之,Apple想要省略任何从swift语法中认为不必要的东西.这意味着什么的小如NSNSError没有确定,在我的解析除上文或功能的新雨燕3.因此,任何其他getData或者findObjects,你需要做的就是Xcode中冷静下来的唯一的事情就是改变NSErrornewCart.saveInBackground { (saved:Bool, error:NSError?) -> Void inError.这样最终结果如下:

let newCart = PFObject(className: "Cart")
newCart.saveInBackground { (saved:Bool, error:Error?) -> Void in
        if saved {
            print("saved worked")
        } else {
            print(error)
        }
    }
Run Code Online (Sandbox Code Playgroud)