SDWebImage/UIImageView+WebCache.h file not found

24,760

Solution 1

A much cleaner "install" of SDWebImage would be as follow:

  1. Drag SDWebImage folder from Finder into your Xcode's project
  2. On any .m file where you wish to use it add: #import "UIImageView+WebCache.h"

    (and any other SD component needed)

    instead of what you probably did: #import <SDWebImage/UIImageView+WebCache.h>

this does not require any project header manipulation and will work as is.

Solution 2

It may happen that:

Unzipping this framework, the directory name may be the following: "SDWebImage-3.3.framework"

If you import the project this way, causes the error "framework SDWebImage not found" when compiling.

You need renaming, deleting "-3.3". Would be: "SDWebImage.framework"

Forcing the renamed from Xcode, causes a bug that close unexpectedly the IDE. Renames from Finder and add framework again.

I hope it's useful ...

Solution 3

I would not wish my worst enemy the frustration I had to go through to fix this problem because none of these solutions helped in my particular case. If your project compiled earlier, you came back to it and this error popped out of nowhere, chances are you've moved it to some new directory - so go to Build Settings > Search Paths > under Framework Search Paths delete the outdated path, create a new one and set it to "$(SRCROOT)" (without quotes) and change the default "non-recursive" to "recursive". I hope this spares someone the agony I endured.

Solution 4

The @Lizard answer saved my day!

$(SRCROOT)/SDWebImage to Header Search Path

Just to be more specific, you have to add that configuration in your target and not in the project view.

Solution 5

Using #import <SDWebImage/UIImageView+WebCache.h> fixed the issue for me as I was using Cocoapods as frameworks (use_frameworks!).

Share:
24,760
Lizard
Author by

Lizard

Updated on July 09, 2022

Comments

  • Lizard
    Lizard almost 2 years

    I'm trying to use SDWebImage in my iPhone app. I followed the step by step tutorial to install SDWebImage into my Xcode project.

    When I try to build my app i'm getting the following error:

    Lexical or Preprocessor Issue
    'SDWebImage/UIImageView+WebCache.h' file not found 
    

    Can somebody help me solve this issue?

  • Lizard
    Lizard almost 12 years
    I have Added Target Depencencies and Link Binary With Libraries as shown in installation tutorial. But still getting this error
  • vishwa.deepak
    vishwa.deepak almost 12 years
  • Lizard
    Lizard almost 12 years
    Solved by adding $(SRCROOT)/SDWebImage to Header Search Path
  • JOM
    JOM over 11 years
    I added to project, so that doesn't make any difference. However I had to use different path "$(SRCROOT)/../SDWebImage", since I don't have SDWebImage inside project folder, but one above (same level as project).
  • xeo
    xeo about 6 years
    this worked for me. and was waaay easier than anything else :)