NSMutableArray *quesArrayForPar0 = [[NSMutableArray alloc] initWithObjects:
[[NSMutableArray alloc] initWithObjects:@"We have a clearly stated vision for the next 5 years.", "-1", nil],
[[NSMutableArray alloc] initWithObjects:@"Our organization has clearly established strategy to achieve the vision.", "-1", nil],
[[NSMutableArray alloc] initWithObjects:@"This strategy is implemented uniformly and effectively throughout our organization.", "-1", nil],
[[NSMutableArray alloc] initWithObjects:@"We are progressing as per our plan to realize this vision within the envisage time horizon.", "-1", nil]
, nil];
我真的不明白为什么上面的代码会抛出异常......!
答案 0 :(得分:3)
因为在内部可变数组中,您分配了两个不同的对象。一个是Obj-C字符串@""
和其他C字符串""
。
所以我改变了你的代码及其工作原理。
NSMutableArray *quesArrayForPar0 = [[NSMutableArray alloc] initWithObjects:
[[NSMutableArray alloc] initWithObjects:@"We have a clearly stated vision for the next 5 years.", @"-1", nil],
[[NSMutableArray alloc] initWithObjects:@"Our organization has clearly established strategy to achieve the vision.", @"-1", nil],
[[NSMutableArray alloc] initWithObjects:@"This strategy is implemented uniformly and effectively throughout our organization.", @"-1", nil],
[[NSMutableArray alloc] initWithObjects:@"We are progressing as per our plan to realize this vision within the envisage time horizon.", @"-1", nil]
, nil];