Ok my code is returning the array. My log for JSONArray bellow returns perfectly so I dont see why the dictionary is giving insane results posted below this code:
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);
// Log for JSONArray – Looks nice //
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;
}
)
// Log for listOfparts – Doesnt look good //
array: (
"<Part: 0x71b5530>",
"<Part: 0x71b5640>"
)
any help would be appreciated!
Update: I dont think my table is getting it right then
Part *eachpart = [listOfparts objectAtIndex:indexPath.row];
cell.label.text = eachpart.part_name;
cell.imageView.image = [UIImage imageNamed:eachpart.part_image];
You are printing
Partswhich I think are classes made by you (like anUIButtonorUIView), do these classes have properties likepartNameorimageName? Print those instead.Btw, your code seems to be working fine 🙂