ARC试图保留无效的内存

时间:2012-12-24 19:12:18

标签: objective-c ios automatic-ref-counting

全部, 当框架调用objc_retain时,抛出EXC_BAD_ACCESS异常。任何帮助或提示追踪问题将不胜感激。如果我应该提供更多代码,请告诉我。

问题区域:

- (SCUuidNode*)addUUIDNode:(NSString*)uuid
{
    const char *uuidCStr = [uuid cStringUsingEncoding:NSASCIIStringEncoding];
    SCUuidNode *uuidNode = [[SCUuidNode alloc] initWithNode:create_uuid_node(uuidCStr)];
    composite_node_append_child((Node*)[self node], [uuidNode node]);

    return uuidNode; # Exception is being thrown right around here.
}

...

Composite *paymentNode = [SCCompositeNode createPriceNode:^(SCCompositeNode *cnode) {
    SCUuidNode *uuidNode = [cnode addUUIDNode:buyerDeviceId];
    SCIntNode *buyerIdNode = [cnode addIntNode:[buyerUserId integerValue]];
}];

1 个答案:

答案 0 :(得分:0)

正如rob和Space Dust所指出的那样,添加僵尸有助于将内存错误追踪到初始化程序。