Swift 2:表达式类型不明确,没有更多上下文

Swift 2: Type of expression is ambiguous without more context

class Example: NSObject, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate {

var aView : UIView!

UIView.animateWithDuration(duration, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.8, options: nil, animations: {

       self.aView.transform = CGAffineTransformIdentity //This line is throwing the error mentioned in the Title


            }, completion: { finished in
                transitionContext.completeTransition(true)
      })


}

这在 Swift 的早期版本中有效,但在版本 2 中失败,不知道为什么

你只需要改变

UIView.animateWithDuration(duration,
  delay: 0.0,
  usingSpringWithDamping: 0.8,
  initialSpringVelocity: 0.8,
  options: nil,
  animations: {

与:

UIView.animateWithDuration(duration,
  delay: 0.0,
  usingSpringWithDamping: 0.8,
  initialSpringVelocity: 0.8,
  options: [],
  animations: {

只有 "options" 需要更改。