nil与预期的参数类型'() - >不兼容虚空”

时间:2015-10-18 17:48:10

标签: swift swift2

SKAction.group([moveToAction, SKAction.fadeAlphaTo(1.0, duration: 0.2)]), completion:nil)

}

runAction(SKAction.waitForDuration(0.2), completion: completion)

当我这样做时,我收到错误:

  

nil与预期的参数类型'() - >不兼容无效“

1 个答案:

答案 0 :(得分:5)

() -> Void不是Optional所以它不能是nil

您应该将空闭包传递为completion参数:

..., completion: {})