-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sd_setImageWithURL calls completion block twice when used with SDWebImageRefreshCached #1090
Comments
Update: I removed second download request I had for the same 2015-03-23 13:21:10.588 App[52095:1907863] Complete = 2, error = (null)
2015-03-23 13:21:10.606 App[52095:1907863] receivedSize = 0, expectedSize = -1
2015-03-23 13:21:10.606 App[52095:1907863] receivedSize = 0, expectedSize = 34220
2015-03-23 13:21:10.606 App[52095:1907863] receivedSize = 34220, expectedSize = 34220 This method that provides progress/completion blocks is totally useless. |
the progress block depends on your server setup as well. if your server setup returns the size of each segment upload then you can use it to show download with percentage. |
I don't see the problem with download from Parse which I use. The progress seems legit. What does not seem legit is that progress is reported after completion block or completion block is never called... |
are you using the latest build? |
Using SDWebImage (3.7.2) according to |
Sometimes it just calls completion block right away, reports that image is cached in memory and then reloads it from server because Could you please test and confirm (or not?) the same problem on your end if you use the same image view and force load the same image twice? Can be in sequence after image is loaded first time. |
i tried in the demo project and you are right on the fact that it calls the completion block 1st before showing the progress report when |
Thanks, yeah it seems odd, I think it should because that's the whole point of SDWebImageRefreshCached I guess.. |
from the comments inside the
thats why you see a completion block 1st and then a small progress when you set the |
Yeah so even if I ignore cached image in completion handler, I am still not being notified when image is refreshed from server. |
if there was a new image in the server then it should be downloaded. |
I see, in my case it hits 304 for sure. I still think that this method defeats its purpose, e.g. too much of internal implementation details exposed, threading issues (#1089) and inconsistency that makes it totally useless in case if you want to animate anything alongside. The only way to get anything useful out of it is to use progress handler and completely forget about completion handler, which is supposed to be called on completion, not randomly. I apologize if I push too hard here. |
no worries. Productive criticism is welcome. |
@pronebird: I tried to fix issues you are complaining here(#1089 #1090 and some others) You can find it here: I think that it will call completedBlock with cancelled error code in case '304', but it can be easy fixed. I will be happy if some body can test it.:-) |
@mythodeia thanks for discussing that matter with me. @timkoma did you send PR already? I'll take a look at your fix. |
@pronebird Did you have a time for review or test ? |
@timkoma Sorry, I've been working a lot on other projects and I had no time to deal with that bug or review your fix so I approached the problem differently. |
Hi again,
Same code with SDWebImageRefreshCached, calls completion block twice.
Log:
Is this a desired behavior? It seems like a bug to me.
The text was updated successfully, but these errors were encountered: