2016-06-28 19 views
3

Ich bekomme einen seltsamen Fehler mit CAKeyframeAnimation, der seltsame Teil ist der "SwiftDeferredNSArray doubleValue" Warum würde ich das bekommen, wenn es um eine Keyframeanimation geht?CAKeyframeAnimation doesNotRecognizeSelector

erhalte ich die folgende Spur, mit diesen Fehlern:

-[_TtCs21_SwiftDeferredNSArray doubleValue]: unrecognized selector sent to instance 0x12b55e060 


*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_TtCs21_SwiftDeferredNSArray doubleValue]: unrecognized selector sent to instance 0x12b55e060' 


#0 0x0000000182ec0d58 in -[NSObject(NSObject) doesNotRecognizeSelector:]() 
#1 0x0000000182ebddcc in ___forwarding___() 
#2 0x0000000182dbcc6c in _CF_forwarding_prep_0() 
#3 0x0000000185b86b24 in CAObject_setValueForKeyPath_() 
#4 0x0000000185b5b9e0 in -[CALayer setValue:forKeyPath:]() 
#5 0x0000000185c6ebd8 in -[CAKeyframeAnimation applyForTime:presentationObject:modelObject:]() 
#6 0x0000000185b5aabc in CA::Layer::presentation_layer(CA::Transaction*)() 
#7 0x0000000187f68b6c in _UIViewEatsTouches() 
#8 0x0000000187f68830 in -[UIView(Geometry) hitTest:withEvent:]() 
#9 0x000000018823f300 in -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:]() 
#10 0x0000000187f68e2c in __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke() 
#11 0x0000000182dab954 in __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke() 
#12 0x0000000182dab84c in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]() 
#13 0x0000000187f68950 in -[UIView(Geometry) hitTest:withEvent:]() 
#14 0x000000018823f300 in -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:]() 
#15 0x0000000187f68e2c in __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke() 
#16 0x0000000182dab954 in __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke() 
#17 0x0000000182dab84c in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]() 
#18 0x0000000187f68950 in -[UIView(Geometry) hitTest:withEvent:]() 
#19 0x00000001881f4cc8 in _UIApplicationHandleDigitizerEvent() 
#20 0x0000000187f2aab8 in _UIApplicationHandleEventQueue() 
#21 0x0000000182e703a4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__() 
#22 0x0000000182e6fe38 in __CFRunLoopDoSources0() 
#23 0x0000000182e6db38 in __CFRunLoopRun() 
#24 0x0000000182d98c60 in CFRunLoopRunSpecific() 
#25 0x000000018466c088 in GSEventRunModal() 
#26 0x0000000187f95fe4 in UIApplicationMain() 
#27 0x00000001001dd614 in main at /Users/MyApp/AppDelegate.swift:20 

Zusatzcode wie gewünscht:

override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) { 

    self.opacityView.layer.removeAnimationForKey("a") 

    if (self.focused) 
    { 
     self.opacityView.layer.addAnimation(a1, forKey: "a") 
    } 
} 


// Animation a1 
let ani = CAKeyframeAnimation(keyPath: "transform.scale") 
ani.timingFunctions = [CAMediaTimingFunction(controlPoints: 0.06,0.756,0.223,1.0)] 
ani.values = [[1.0,1.0,1.0],[1.0*scaleFactor,1.0*scaleFactor,1.0*scaleFactor]] 
ani.duration = 0.267 
ani.fillMode = kCAFillModeForwards 
ani.removedOnCompletion = false 
+0

Können Sie einige der Code, wo der Fehler auftritt? – J2K

+0

Sicher, ich füge es während einer Fokusaktualisierung zu einer Ebene hinzu. – Chris

Antwort

0

Ich weiß, das ein bisschen spät, aber ich dachte sowieso eine Antwort geben würde für andere Leute, die auf diesen Fehler stoßen. Soweit ich sehen kann, würde ich vermuten, dass Sie dies sehen, weil ein Array einzelner Keyframe-Werte sein sollte, nicht ein Array von Arrays. ZB

ani.values = [1.0, 1.0*scaleFactor]