I'm using SDWebImage with CocoaPods, and the app I'm working on must support iOS7.
After installing SDWebImage version 4.0.0 with CocoaPods, I import it into a class with #import <SDWebImage/UIImageView+WebCache.h>
.
I use one of the category's methods, sd_setImageWithURL:
, to asynchronously download an image.
This works fine on iOS8-10. But for some reason (only on iOS7), the app crashes saying that the sd_setImageWithURL:
is an unrecognized selector.
Why would the category not load properly on only one OS? This doesn't make any sense to me at all. :/
Update: I ran an analysis on the project, and I noticed this warning:
ld: warning: ignoring file <path/to/file>/libSDWebImage.a, file was built for archive which is not the architecture being linked (armv7): <path/to/file>/libSDWebImage.a
(The path was really long. I replaced it with <path/to/file>
)
As I suspected, this warning does not show up when running on newer versions of iOS, which also use a different architecture, arm64.
So, it looks like the library libSDWebImage.a
is being build for arm64. What can I do about this?
I set Build Active Architecture Only
to NO in Build Settings, then did the "deep clean" as suggested by the answer here: Undefined symbols for architecture armv7: cocoaPods iPhone 5
That seemed to solve the issue for me.