SCNIKConstraint: convenience function succeeds, initializer crashes
Originator: | igeek1 | ||
Number: | rdar://47774257 | Date Originated: | 03-Feb-2019 05:11 PM |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Product Version: | Xcode 10.1 (10B61) on macOS 10.14.2 (18C54) |
Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary: SCNIKConstraint provides two initialization mechanisms: an initializer and a class method (i.e. factory method). The factory method works, and the initializer fails with EXC_BAD_ACCESS, but the documentation doesn’t mention this. Steps to Reproduce: 1. Run this code in an iOS playground or app. I’m using iOS 12.1. import SceneKit let node1 = SCNNode() let ikConstraint1 = SCNIKConstraint.inverseKinematicsConstraint(chainRootNode: node1) let node2 = SCNNode() let ikConstraint2 = SCNIKConstraint(chainRootNode: node2) // EXC_BAD_ACCESS Expected Results: No crash. The lines behave identically. Actual Results: EXC_BAD_ACCESS when using the initializer. In all the examples I’ve tried, replacing the initializer with the class function makes everything start working. Version: Xcode 10.1 (10B61) on macOS 10.14.2 (18C54) Notes: The declarations are basically identical, and the docs don’t mention anything that might be amiss. Here’s the generated Swift interface for iOS 12.1: /*! @method initWithChainRootNode: @abstract Creates and returns a SCNIKConstraint object with the specified parameter. @param chainRootNode The root node of the kinematic chain. @discussion "chainRootNode" must be an ancestor of the node on which the constraint is applied. */ @available(watchOS 2.0, *) public init(chainRootNode: SCNNode) /*! @method inverseKinematicsConstraintWithChainRootNode: @abstract Creates and returns a SCNIKConstraint object with the specified parameter. @param chainRootNode The root node of the kinematic chain. @discussion "chainRootNode" must be an ancestor of the node on which the constraint is applied. */ open class func inverseKinematicsConstraint(chainRootNode: SCNNode) -> Self
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!