iosobjective-cxcodeframeworkssdwebimage

Can't use SDWebImage


Xcode: Version 7.2

OS X: 10.10.5


I'm a newbie into iOS and trying to use SDWebImage in Objective-C by following the official installation guide, but I get this error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SDWebImageManager", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I downloaded the zip file and unzip-ed it, and added the file to my project.

Also, added a dependency "ImageIO.framework" and Linker Flag "-ObjC".

Screenshot

I've already read these questions:


Solution

  • Don't download and unzip. This is really the most horrible way to do things. Use CocoaPods, Carthage or at least git submodules. The "unzip way" makes code harder to maintain: you cannot know which version you imported (when you go back to this project in a year), noone knows where is the reference. People will manually change the source files, so later you won't be able to update to the newer version without losing these changes. You also have to setup your project manually, which as it seems, is troublesome for you (and many others, don't worry). Easiest way to fix it? Use CocoaPods.

    To do it, open console and type:

    $ sudo gem install cocoapods
    

    Close your project in Xcode. Open the path to your .xcodeproj in console. Type:

    $ pod init
    

    Open .podfile. Paste there pod 'SDWebImage', '~> 3.7'. In console type:

    $ pod install
    

    When it completes, open .xcodeworkspace. Everything should be working fine now.