Swift Parse progressBlock:调用中的额外参数

时间:2015-06-19 09:50:47

标签: swift parse-platform progress

错误说:额外参数' progressBlock'在电话中。 怎么了?

pin.saveInBackgroundWithBlock({(success, error) -> Void in
    if success == false {
        ...
     } else {
          ...
      }

  },
    progressBlock: { (amountDone: CInt) -> Void in
        var percent = Float(amountDone)
        elf.progressIndicatorView.progress = CGFloat(percent)/100

        self.progressIndicatorView.reveal()

  })

2 个答案:

答案 0 :(得分:0)

尝试:

 pin.saveInBackgroundWithBlock({ (succeeded: Bool, error: NSError?) -> Void in
    // Handle success or failure here ...
    if succeeded {
        println("Save successful")
    } else {
        println("Save unsuccessful: \(error?.userInfo)")
    }

    }, progressBlock: { (amountDone: Int32) -> Void in
          var percent = Float(amountDone)
          self.progressIndicatorView.progress = CGFloat(percent)/100
          self.progressIndicatorView.reveal()
})

答案 1 :(得分:0)

最近几年对Swift语法的很多更改。这似乎是2018年的工作

file!.saveInBackground({ (_ didSucceed:Bool, err:Error?) in
                print("success: \(didSucceed)")
            }) { (progress:Int32) in
                print("progress: \(progress)")
            }