Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift iOS 14中的caanimationdelegate?_Swift_Ios14_Caanimation - Fatal编程技术网

Swift iOS 14中的caanimationdelegate?

Swift iOS 14中的caanimationdelegate?,swift,ios14,caanimation,Swift,Ios14,Caanimation,我正在开发一款在iphone iOS 13.x上运行良好的应用程序,但在iOS 14中,我遇到了以下问题: 函数AnimationDidStop中的CAAnimationdelegate正在接收正确的停止,但不是正确的动画对象 我用 类myAnimation:CAKeyframeAnimation{ var myKey : String?=nil var sender : gameDelegate?=nil override init() { super.init() } conve

我正在开发一款在iphone iOS 13.x上运行良好的应用程序,但在iOS 14中,我遇到了以下问题: 函数AnimationDidStop中的CAAnimationdelegate正在接收正确的停止,但不是正确的动画对象

我用

类myAnimation:CAKeyframeAnimation{

var myKey : String?=nil
var sender : gameDelegate?=nil

override init() {
    super.init()
}

convenience init(key:String,sender:gameDelegate){
    self.init()
    self.myKey = key 
    self.sender = sender
}
}

对动画的调用是
让myAnim=myAnimation(key:myString,sender:myGameDelegate)
初始化myAnimation对象时,地址为self.myAnimation 0x0000000282450600

然后…初始化动画参数

 ...addAnimation to SCNNode
此时,所有参数都存在,地址为stil x.myAnimation 0x0000000282450600

动画已正确播放

动画结束时,在AnimationDidStop(动画:CAAnimation,标志:bool)中调用代理时 传递给此函数的动画是正确的myAnimation类型(调试器),但似乎是一个未初始化的块(var myKey和var sender均为nil),具有指向先前播放的动画的不同(错误)地址:x.myAnimation 0x00000002824677e0

CAAnimationDelegate是扩展的一部分


所以,任何人都不知道为什么这在iOS 13上正常工作。而不是在iOS 14上,可以做什么?编译器设置?

@Rob通过向动画中添加我自己的关键点解决了问题,如:setValue(value:forkey:)。我仍然不清楚为什么子类myAnim中的变量在从CAAnimation向子类myAnim:CAKeyframe Animation.value反向转换animationdidstop(::)后没有值