AFImageRequestOperation返回未下载的图片 [英] AFImageRequestOperation returns image that not downloaded competely
问题描述
+[AFImageRequestOperation imageRequestOperationWithRequest:
imageProcessingBlock:
success:
failure:]
如果互联网返回的图片(特别是PNG)没有完全下载和故障阻塞,在这种情况下,不调用。
In case of slow internet returns image (PNG particularly) that didn't download completely and failure block, in this situation, is not being called.
如何检查图片是否正确下载?
How can I check that the image did or didn't download correctly?
/ strong>你会有什么类型的请求没有真正的问题:image,xml,json或http,文件下载可能会失败。
It doesn't really matter what type of request you will have: image, xml, json or http, there are a probability that file downloading will fail. And as file becomes bigger and internet becomes slower the probability increases.
推荐答案
部分解决方案建立在这个问题中:
捕获错误:损坏了JPEG数据:数据段提前结束
检测PNG文件是否在目标C中损坏
Partial solution founded in this questions:
Catching error: Corrupt JPEG data: premature end of data segment
Detect if PNG file is corrupted in Objective C
因此,下载映像后,正确的开始和结束字节。
So, after image was downloaded, you can check does it have correct starting and ending bytes.
修改:这里是一个更灵活的解决方案。
Here is a more flexible solution.
这篇关于AFImageRequestOperation返回未下载的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!