Objective c SpriteKit convertPoint:toNode:抛出EXC\u BAD\u访问错误

Objective c SpriteKit convertPoint:toNode:抛出EXC\u BAD\u访问错误,objective-c,memory,sprite-kit,exc-bad-access,Objective C,Memory,Sprite Kit,Exc Bad Access,我在函数弧中提取了以下代码: -(CGFloat)getRotationAngleFromJoint:(BAJoint*)from_joint toJoint:(BAJoint*)to_joint { // Here we basically have a node graph where joints are connected by bones. // In this case we have these connections: from_joint -> from_

我在函数弧中提取了以下代码:

-(CGFloat)getRotationAngleFromJoint:(BAJoint*)from_joint toJoint:(BAJoint*)to_joint {
    // Here we basically have a node graph where joints are connected by bones.
    // In this case we have these connections: from_joint -> from_bone -> from_joint2
    //
    // BAJoint and BABone both derived classes of SKShapeNode

    __weak BABone *from_bone = (BABone*)[from_joint.children objectAtIndex:0];
    __weak BAJoint *from_joint2 = (BAJoint*)[from_bone.children objectAtIndex:0];

    CGPoint k = CGPointMake(0, 0);
    CGPoint p1 = [from_joint2 convertPoint:k toNode:from_joint.parent];
特此声明:

@interface BAJoint : SKShapeNode <NSCoding, NSCopying>

@property BOOL rootJoint;

-(void)setRootJoint;
-(void)select;
-(void)deselect;

@end
from_joint2、from_joint、from_joint.parent都是非零弱指针,但我在调用convertPoint:toNode:

我已经通过记录位置iVar(例如from_joint.position)来确认弱指针指向有效内存,并且在这些情况下会记录一个合理的值。至少我认为一个合理的值意味着指针指向内存中的一个有效位置

启用僵尸也不会显示任何内容,启用异常断点甚至不会捕捉到这一点

知道convertPoint:toNode:可能抛出EXC\u BAD\u访问错误的原因吗?在这种特殊情况下,哪些因素可能导致此错误发生

我真的很感激在这方面的任何帮助,因为我已经花了很长时间研究它。我对Objective-C很陌生

更新

在阅读了StackOverflow上的一些帖子之后,我暗自怀疑SKShapeNode被窃听了,不值得信任。我通过使用SKNode*实例复制子图并将convertPoint:toNode:应用于SKNodes而不是SKShapeNodes来解决问题


此外,SKShapeNode似乎经常泄漏内存,这里的其他帖子也指出了同样的情况。

什么样的对象来自\u joint2和\u joint?我已经包含了上面的BAJoint声明。信息技术它基本上是一个SKShapeNode,有一些小的添加。当它崩溃时,它的.children数组中存储了什么?堆栈跟踪上没有什么有趣的东西?Xcode在底部有一个滑块来显示整个过程。