好的,我的代码正在返回数组。JSONArray bellow 的日志完美返回,所以我不明白为什么字典在此代码下方给出了疯狂的结果:
NSMutableArray *listOfparts = [[NSMutableArray alloc] init];
for (NSDictionary *object in JSONArray) {
Part *part = [[Part alloc] initWithpartName:object[@"case_name"]
imageName:object[@"case_image"]];
[listOfparts addObject:part];
}
NSLog(@"array: %@", JSONArray);
// 记录 JSONArray - 看起来不错 //
array: (
{
"case_color" = White;
"case_description" = "";
"case_image" = "";
"case_name" = "NZXT Phantom 410";
"case_price" = "99.99";
"case_type" = ATX;
id = 1;
},
{
"case_color" = Black;
"case_description" = "";
"case_image" = "";
"case_name" = "Thermaltake MK+";
"case_price" = "84.99";
"case_type" = ATX;
id = 2;
}
)
// 记录 listOfparts - 看起来不太好 //
array: (
"<Part: 0x71b5530>",
"<Part: 0x71b5640>"
)
任何帮助,将不胜感激!
更新:我不认为我的桌子做得对
Part *eachpart = [listOfparts objectAtIndex:indexPath.row];
cell.label.text = eachpart.part_name;
cell.imageView.image = [UIImage imageNamed:eachpart.part_image];