Kingfisher: Crash in Xcode 11.2 with EXC_BAD_INSTRUCTION in ImageDownloader
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
- I have read the wiki page and cheat sheet, but there is no information I need.
- I have searched in existing issues, but did not find a same one.
- I want to report a problem instead of asking a question. It’d better to use kingfisher tag in Stack Overflow to ask a question.
Issue Description
Crash with error Thread 1: EXC_BAD_INSTRUCTION (code=1, subcode=0x210007) in ImageDownloader.swift line 169.
What
When adding any URL via URL(string:) and then setting in an UIImageview the image with UIImageView.kf.setImage(with:url)a crash occurs in line169 in ImageDownloader.swift:
sessionDelegate.onReceiveSessionChallenge.delegate(on: self) { (self, invoke) in
self.authenticationChallengeResponder?.downloader(self, didReceive: invoke.1, completionHandler: invoke.2)
}
Reproduce
Clone and run the sample project at:https://github.com/juanjoseluisgarcia/kignfishertest.git
Other Comment
It happens with all branches and version 5.9.0. I am downloading KingFIsher via Package Manager in Xcode 11.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 22
- Comments: 15 (7 by maintainers)
Commits related to this issue
- workaround for Xcode 11.2 https://github.com/onevcat/Kingfisher/issues/1330 — committed to bonyadmitr/XcodeProjects by bonyadmitr 5 years ago
Per a tweet on twitter, the workaround for this issue with Xcode 11.2 is to use the build setting DEAD_CODE_STRIPPING = NO
https://twitter.com/tcldr1/status/1190396639334285312?s=21
@juanjoseluisgarcia @MattCheetham @tarasis @chrisjeane
May I confirm that you are all using Swift Package Manager to add Kingfisher to your project? According to some attempts myself, it seems that this issue only happens when using SPM. Is this also your case? It would be a great help if you can let me know your integrating way!
Seeing exactly the same issue here. Project was running fine, updated to Xcode 11.2 Beta 2 and now I get this crash.
This bug is fixed in the latest Xcode 11.3 beta
This issue did not get a fix in the latest Xcode 11.2.1 GM today. It seems that there is a “workaround” to try to rearrange method order to prevent the stripping happen. But there are quite a few cases in Kingfisher this would happen and it is hard to test them all. So I suggest the workaround posted by @tarasis to turn off
DEAD_CODE_STRIPPINGbefore Apple can give a fix on it.It seems duplicated to #1306 and https://github.com/mxcl/PromiseKit/issues/1099
This issue is already reported in https://bugs.swift.org/browse/SR-11604, https://bugs.swift.org/browse/SR-11564, and https://bugs.swift.org/browse/SR-11567
Currently, I cannot find a way to solve it except waiting for Apple to give a fix on SPM.
If SPM is not a must for your project, you can switch to CocoaPods or Carthage to get a workaround. Otherwise, I suggest keeping Xcode 11.1 for a while longer. 😦
Yes. Edited.