无法使用类型的参数列表调用animateWithDuration

Ant*_*ine 1 uiview ios swift swift2

我试图使用JSSAlertView(github.com/stakes/JSSAlertView)与Swift 2.0,但我有一个错误:

Cannot invoke animateWithDuration with an argument list of type '(Double, delay: Double, usingSpringWithDampling: Double, initialSpringVelocity: Double, options: nil, animations () -> _, completion: (Bool) -> _)'
Run Code Online (Sandbox Code Playgroud)

代码:

UIView.animateWithDuration(0.5, delay: 0.05, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.5, options: nil, animations: {
        self.containerView.center = self.rootViewController.view.center
        }, completion: { (finished: Bool) in
    })
Run Code Online (Sandbox Code Playgroud)

我看到了这两个答案: 嵌套的闭包不喜欢参数列表 UIView动画在Swift中不起作用,错误的参数错误 但它们对我没有帮助.

我仍然认为问题来自"动画"或"完成".

new*_*cct 6

从Swift 2开始,选项集nil不再可转换,因此您无法使用nil.但是,它们是数组文字可转换(对于要一起进行OR运算的选项数组),因此您可以使用[]无选项.