Skip to content
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

Can't fetch small images, API MISUSE, SwiftUI #1950

Closed
3 tasks done
zzzkk opened this issue Jun 7, 2022 · 7 comments
Closed
3 tasks done

Can't fetch small images, API MISUSE, SwiftUI #1950

zzzkk opened this issue Jun 7, 2022 · 7 comments

Comments

@zzzkk
Copy link

zzzkk commented Jun 7, 2022

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

Issue Description

What

Some images fetch always fails, my observation is that it applies only to smaller images like
https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
for this https://raw.githubusercontent.com/onevcat/Kingfisher/master/images/logo.png it works fine 🤔

Reproduce

KFImage.url(url)
    .onSuccess { r in
        print(r) // never called
    }
    .placeholder { p in
        ProgressView(p) // shows up to 100%
    }

Other Comment

console output:

API MISUSE: NSURLSession delegate KFSessionDelegate: <KFSessionDelegate: 0x28252ac40> (0x28252ac40)
API MISUSE: dataTask:willCacheResponse:completionHandler: completion handler not called
  • completion for sessionTask.onTaskDone.delegate(on: self) { (self, done) in is never called
  • using debuging tool I can see successful http response with image
@onevcat
Copy link
Owner

onevcat commented Jun 8, 2022

Ummm. It is weird. Kingfisher never implements the willCacheResponse delegate method. I will see if I can reproduce it and try to understand what is going on.

@onevcat
Copy link
Owner

onevcat commented Jun 8, 2022

Not sure I am doing the right thing or not, but when running in the demo project, it seems everything goes well:

截屏2022-06-08 15 08 35

@zzzkk Is it a 100% reproducible issue? Can you also try on some other simulator/device/network condition and share more information about it? (Or are you trying to extend KFSessionDelegate (or SessionDelegate in Swift) and implement some willCacheResponse method in your project?)

@onevcat
Copy link
Owner

onevcat commented Jun 8, 2022

Maybe a reproducible sample repo would be a great help for us to track this issue better!

@zzzkk
Copy link
Author

zzzkk commented Jun 8, 2022

right, issue reproduces only in my repo, no matter which device/network/etc
I'm not extending session delegate or modifing other networking related logic

but

maybe some other external library I use is messing it up?
I'll try to turn them off one by one and check if it fixes Kingfisher behaviour 🤔

@onevcat
Copy link
Owner

onevcat commented Jun 8, 2022

maybe some other external library I use is messing it up?

Maybe. But actually, that's beyond what I can imagine... Kingfisher is creating its own URLSession when downloading an image and the session delegate is also defined inside the project. So not sure what can cause the "API MISUSE". Please let me know if you can find anything. Thanks!

@zzzkk
Copy link
Author

zzzkk commented Jun 9, 2022

all right, I found it!
it is the debugging tool I use, it seems they have some faulty swizzling 😞
dbukowski/DBDebugToolkit#68

thanks for quick response and help @onevcat

@zzzkk zzzkk closed this as completed Jun 9, 2022
@onevcat
Copy link
Owner

onevcat commented Jun 10, 2022

Thanks for the feedback. Great to hear you found that!

That is a very common mistake that one forgets calling the handler. I guess once DBDebugToolKit fixes it, everything should go back working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants