I am using the SDWebImage open source project for loading images asynchronously. I can build & run for the simulator as well as for my local device. However, when i try to build for distribution (i.e. Archive), the compiler doesn't seem to understand what the header file is:
I pretty much followed the instructions, with relative ease, described here on github.com/rs/SDWebImage.
I knew things were going way too smoothily/easily to be true. Oddly, i've never really faced an issue that is exclusive to Archiving. Anybody tried Archiving with SDWebImage before?
* Updated * I updated based on comment below. Now i am getting the following error while Archive building:
arm-apple-darwin10-llvm-gcc-4.2: Poll/BuildProductsPath/Release-iphoneos/libSDWebImage.a: No such file or directory Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
The strange thing is that i have the sdwebimage.a file in my project (there's actually 2, one that i copied and included, and the 2nd one from the SDWEbImage project itself).
* Update 2 * Upon further investigation, my SDWebImage project is NOT getting built when i Archive (the .a file is red). But any other build type works fine. I looked everywhere and it seems like the SDWebImage project has the distribution configurations. Not sure what else could be the issue here.
As such, we have moved/built new modules to SDWebImage org. SwiftUI is an innovative UI framework written in Swift to build user interfaces across all Apple platforms. We support SwiftUI by building a brand new framework called SDWebImageSwiftUI, which is built on top of SDWebImage core functions (caching, loading and animation).
However, starting with CocoaPods 1.5.0+ (with Xcode 9+ ), which supports to build both Objective-C && Swift code into static framework. You can use modular headers to use SDWebImage as static framework, without the need of use_frameworks!: If not, you still need to add use_frameworks! to use SDWebImage as dynamic framework:
Thank you to all the people who have already contributed to SDWebImage. All source code is licensed under the MIT License. To learn about SDWebImage's architecture design for contribution, read The Core of SDWebImage v5.6 Architecture. Thanks @looseyi for the post and translation.
SwiftUI is an innovative UI framework written in Swift to build user interfaces across all Apple platforms. We support SwiftUI by building a brand new framework called SDWebImageSwiftUI, which is built on top of SDWebImage core functions (caching, loading and animation).
You can keep your setup as you have it. All that is needed is to add the header files to the search path. To add the needed header files to the search path do the following.
"$(SOURCE_ROOT)/SDWebImage"
(thats
with quotes).This works when importing like this #import <SDWebImage/UIImageView+WebCache.h>
So, I have and may others had had this same problem. I worked on it for awhile this morning and found all the suggestions are not working.
How I got it to work is to add the Workspace lib to your project, as it stated in the instructions. Make sure the file isn't red, I had to play around removing it and adding the header search path again.
Finally, I was able to see the libSDWebImage.a file.
Right click on that file and "Show in Finder"
Move libSDWebImage.a and SDWebImage/.h files to a directory you will not delete
Add the libSDWebImage.a and SDWebImage/.h files to you project
You can archive now.
Hope it works for you.
I tried all of the above methods of adding header paths.. nothing worked. I'm able to build the project fine in debug but not archive. I just tried something simple and it did work.
The file "UIImageView+WebCache.h" is part of the subproject SDWebImage.xcodeproj.. In my main workspace project I simply did "Add File" and found the "UIImageView+WebCache.h" on disk and added it to my main project. Now that file is part of my main project. Ran Archive and it worked.. I little dumb, but it worked at least
I solved it very easily by adding (with quotes):
"$(SRCROOT)/SDWebImage"
to the various Header Search Paths under my project's Build Settings. Thanks to Lizard in SDWebImage/UIImageView+WebCache.h file not found for his solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With