0
我想要一个的tableview细胞的UIImage的设置为一个绝对的URL,这里的代码我已经:如何使用绝对URL设置UIImage?
NSString * imageURL = [[stories objectAtIndex:indexPath.row] objectForKey:@"images"];
NSURL *url = [NSURL URLWithString:imageURL];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
//set image
cell.imageView.image = img;
但出于某种原因,这将返回NULL作为如果提供的URL是无效的。然而我知道这不是这种情况,因为我可以通过输入一个URL作为字符串文字到imageURL指针,我知道代码[[stories objectAtIndex:indexPath.row] objectForKey:@“images”]返回正确的URL,因为我打印输出到日志,它很好。
是否有任何理由为什么会发生这种情况,我显然没有在这里看到?