user2494343 user2494343 - 3 months ago 53
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:@"http://dev.apppartner.com/AppPartnerProgrammerTest/images/justin_avatar.png,http://dev.apppartner.com/AppPartnerProgrammerTest/images/drew_avatar.png"\]placeholderImage:\[UIImage imageNamed:@"placeholder"\]\];

\[cell loadWithData:chatData\];

return cell;][1]
}

Answer

It is because that your url is not found on server, I mean your url (http://dev.apppartner.com/AppPartnerProgrammerTest/images/justin_avatar.png,http://dev.apppartner.com/AppPartnerProgrammerTest/images/drew_avatar.png) is wrong. If I open this url in browser then it throws error 404 like The requested URL /AppPartnerProgrammerTest/images/justin_avatar.png,http://dev.apppartner.com/AppPartnerProgrammerTest/images/drew_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!!!