Alexander
Alexander

Reputation: 770

AFImageRequestOperation returns image that not downloaded competely

+[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.

Upvotes: 1

Views: 890

Answers (1)

Alexander
Alexander

Reputation: 770

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.

Upvotes: 1

Related Questions