0

A XML parser is trying to alloc its delegate's NSMutable array called masterCodeList. From the following code, you'll see that this fails. (I am a total newbie.)

if (dataController.masterCodeList == nil){

    dataController.masterCodeList =[[NSMutableArray alloc] init];
    if (dataController.masterCodeList == nil) {
        NSLog(@"the init of the mutable array did NOT work");
    }
}

I get the the init of the mutable array did NOT work message every time. I am importing the dataController header.

#import "CodeDataController.h"

I am getting no other error message, the parser is parsing fine and the app is running smoothly without content.

Thanks in advance.

4

2 回答 2

1

您对 masterCodeList 的声明是什么样的?它是一个属性,它是合成的,还是你正在制作自己的 setter/getter?

另一种方法是尝试使用中间占位符,即:

NSMutableArray *temp = [[NSMutableArray alloc] init];
[dataController setMasterCodeList:temp];

看看这是否正确设置了你的数组。

(注意:该代码可能有泄漏,也可能没有泄漏)

于 2012-06-01T21:23:29.760 回答
0

你能在这个类中发布你对 dataController 对象的实现,以及它在另一个类中的属性吗?

您可能还想尝试使用 isEqual 方法而不是 == nil。

于 2012-06-01T21:26:26.700 回答