문제

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:

import "UIImageView+WebCache.h" (no such file or directory).

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

  1. Select your project file
  2. Select your target
  3. Select Build settings
  4. In the search box enter 'header search paths'
  5. For the Release add "$(SOURCE_ROOT)/SDWebImage" (thats with quotes).

This works when importing like this #import <SDWebImage/UIImageView+WebCache.h>

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.

For me this one worked, when addded to Header Search Paths (it is exact path to the SDWebImage project)

"$(PROJECT_DIR)/ProjectName/Libraries/SDWebImage"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top