XML 解析器正在尝试分配其委托(delegate)的名为 masterCodeList 的 NSMutable 数组。从下面的代码中,您将看到此操作失败了。 (我是个新手。)
if (dataController.masterCodeList == nil){
dataController.masterCodeList =[[NSMutableArray alloc] init];
if (dataController.masterCodeList == nil) {
NSLog(@"the init of the mutable array did NOT work");
}
}
我每次都会收到可变数组的初始化没有工作
消息。我正在导入 dataController header 。
#import "CodeDataController.h"
我没有收到其他错误消息,解析器解析正常,并且应用程序运行顺利,没有内容。
提前致谢。
最佳答案
您的 masterCodeList 声明是什么样的? 它是一个属性,是合成的,还是您正在制作自己的 setter/getter?
另一种方法是尝试使用中间占位符,即:
NSMutableArray *temp = [[NSMutableArray alloc] init];
[dataController setMasterCodeList:temp];
看看这是否正确设置了你的数组。
(注意:代码可能有泄漏,也可能没有泄漏)
关于ios - NSMutable 数组不会分配,仍然为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10857481/