SDWebImage/UIImageView+WebCache.h file not found

前端 未结 10 2493
予麋鹿
予麋鹿 2020-12-28 21:59

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 ge

相关标签:
10条回答
  • 2020-12-28 22:14

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

    0 讨论(0)
  • 2020-12-28 22:17

    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.

    0 讨论(0)
  • 2020-12-28 22:19

    I was also getting this problem. Solution for me was to add SDWebImage.framework, instead of adding all files in my project. Here is the check list to make sure everything is setup as suggested by auther here.

    Download and Add framework

    Step 1: Download and unzip the lastest version here: https://github.com/rs/SDWebImage/wiki/Download-Complied-Framework

    Step 2: Right-click on the project navigator and select "Add Files to "Your Project": In the dialog, select SDWebImage.framework, and check the "Copy items into destination group's folder (if needed)" checkbox

    Add dependencies

    In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block: Click the "+" button again and select the "ImageIO.framework"

    Add Linker Flag

    Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag:

    Import headers in your source files

    #import <SDWebImage/UIImageView+WebCache.h>
    

    It should build now without any problem.

    0 讨论(0)
  • 2020-12-28 22:21

    Check if you have linked the file correctly and its in your bundle or not.

    0 讨论(0)
  • 2020-12-28 22:24

    I got this error when I was removing some old unused Pods while keeping the XCode open. I have seen and read that you must keep XCode closed while doing any pod operation. Once pod operation is done, you should then reopen xcworkspace file and build.

    Did the same closed the XCode, but also I removed the contents of Derived data just to start from a fresh page. It worked !

    0 讨论(0)
  • 2020-12-28 22:32

    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.

    0 讨论(0)
提交回复
热议问题