问题
+[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