AFImageRequestOperation returns an image that is not loaded

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

In the case of a slow return image to the Internet (especially PNG), which did not load completely and the failure unit, is not called in this situation.

How can I check if the image loaded correctly or incorrectly?

Edit: It doesn't matter what type of request you have: image, xml, json or http, there is a chance that the file download will fail. And as the file gets larger and the Internet becomes slower, the likelihood increases.

+1
source share
1 answer

Partial solution based on this question:
Trap: Corrupt JPEG data: premature end of data segment
Detect if PNG file is damaged in Objective-C

So, after loading the image, you can check if it has the correct start and end bytes.

Edit: Here is a more flexible solution.

+1
source

Source: https://habr.com/ru/post/1443800/


All Articles