为什么这个函数给我一个“由于信号而失败的命令”错误?

时间:2017-05-26 16:28:14

标签: swift xcode compiler-errors

当我使用这个方法时,我的项目将无法编译,但每当我删除它时我都没有错误,我很困惑为什么会发生这种情况。这就是我正在使用的

func animateNode(object: AnyObject){
    AnyObject.animate(withDuration: 1.0, animations: {
        var objFrame = object.frame
        objFrame.origin.y -= objFrame.size.height

        object.frame = objFrame

    },completion: { finished in
        print("Animation Complete")
    })
}

1 个答案:

答案 0 :(得分:0)

Swift 3

看看括号。

AnyObject.animate(withDuration: 1.0, animations: {
    // Code ...
}) { finished in
    // Code ...
    print("Animation Complete")
}

我希望这可以帮到你。