我用[NSMutableArray array]初始化的数据,添加数据模型类就没事,添加字符串成员就报错。
[[NSMutableArray array]init]添加字符串就没事
- [NSMutableArray *array = [NSMutableArray array];
- //没事
- NSString *name = [NSString stringWithFormat:@"这本书是第%d本",i];
- NSString *icon = [NSString stringWithFormat:@"00%d.png",i];
- NSString *desc = [NSString stringWithFormat:@"第%d本.......",i];
- shop *po = [shop shopWithName:name andIcon:icon andDesc:desc];
- [array addObject:po];
- //报错
- [array addObject:[NSString stringWithFormat:@"s:%d--i:%d",0,10]];
- //没事
- array = [[NSMutableArray array] init];
- [array addObject:[NSString stringWithFormat:@"s:%d--i:%d",0,10]];
复制代码
|
|