user2494343 user2494343 - 1 year ago 207
Objective-C Question

Why am I getting a CFNetwork internal error when I try to load multiple images from a local json file into my tableview?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

[static NSString *cellIdentifier = @"ChatCell";
ChatCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell"];

if (cell == nil)
\[tableView registerNib:\[UINib nibWithNibName:cellIdentifier bundle:nil\] forCellReuseIdentifier:@"myCell"\];

cell = \[tableView dequeueReusableCellWithIdentifier:@"myCell"\];

ChatData *chatData = \[self.loadedChatData objectAtIndex:\[indexPath row\]\];

\[cell.images sd_setImageWithURL:\[NSURL URLWithString:@","\]placeholderImage:\[UIImage imageNamed:@"placeholder"\]\];

\[cell loadWithData:chatData\];

return cell;][1]

Answer Source

It is because that your url is not found on server, I mean your url (, is wrong. If I open this url in browser then it throws error 404 like The requested URL /AppPartnerProgrammerTest/images/justin_avatar.png, was not found on this server. You can try to open this url in browser. Otherwise your code seems to be alright. there is no problem with code i think!!!