AFImageRequestOperation returns image that not downloaded competely

[亡魂溺海] 提交于 2019-12-23 04:01:45

问题


+[AFImageRequestOperation imageRequestOperationWithRequest:
                                      imageProcessingBlock:
                                                   success:
                                                   failure:]

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?

Edit: 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.


回答1:


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.

Edit: Here is a more flexible solution.



来源:https://stackoverflow.com/questions/12722436/afimagerequestoperation-returns-image-that-not-downloaded-competely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!