davbeck / ImageIOSwift

Swift wrapper around ImageIO
MIT License
111 stars 15 forks source link

Unclear error message keep popping up #4

Open gouen95 opened 5 years ago

gouen95 commented 5 years ago

When I am downloading an image, these error keep popping up in my console log. And btw one question.. is there image caching support?

2019-01-04 17:33:41.219260+0800 ImageIOSwift_Example[33707:774797] [0x7b9c0000a800] Decoding: C0 0x017901F4 0x0000354A 0x11111100 0x00000000 60928 2019-01-04 17:33:41.219493+0800 ImageIOSwift_Example[33707:774797] [0x7b9c0000a800] Options: 377x500 [FFFFFFFF,FFFFFFFF] 00024060 2019-01-04 17:33:42.219564+0800 ImageIOSwift_Example[33707:774797] [0x7b9c00000000] Decoding failed with error code -1

davbeck commented 5 years ago

Does decoding actually fail? If not, I would guess that this is just os_log garbage from the system (ImageIO, and not ImageIOSwift).

With regards to caching, yes. NSCache is used by the shared downloader to avoid loading the same image into memory multiple times, and the URLSession cache is used to avoid downloading the same image multiple times, which is persisted between launches and follows the servers rules.

gouen95 commented 5 years ago

I see, the decoding didn't actually fail and everything is downloaded perfectly.

Regarding the caching problem, I've made an example youtube video to demonstrate the problem. First, I did a simultaneous download of same url image. After the download is done, and then I click on one of the cell, I will pass the url to second page and try to display the image using the shared downloader. But it seemed like I need to download again.

davbeck commented 5 years ago

Are you sure it’s completely finished downloading? If it’s a progressive jpeg it may still be loading more details. And if it doesn’t quit finish, it will start over like this. You can see that happening in the example app as well.