目标 C:无法从网址 http://image.ohozaa.com/i/3ca/inIHge.jpg 显示 UIImage


NSURL *imageUrl = [NSURL URLWithString:@"http://image.ohozaa.com/i/3ca/inIHge.jpg"];
NSData *imageData = [NSData dataWithContentsOfURL:imageUrl];
UIImage *image = [UIImage imageWithData:imageData];

image return nil

UIImage可以正常显示另一个url

可以在此URL设置UIImage吗?

图片加载时间超过1分钟。将映像放在更快的服务器上,或者使用更可靠的方法下载数据。NSData dataWithContentsOfURL不处理错误,也不允许您配置超时。一般不建议使用

相反,要么用NSURLConnection自己滚,要么尝试AFNetworking(在github上)。

相关内容

最新更新