Xcode clang error when adding SDWebImage framework

868 Views Asked by At

I am trying to compile an app that use SDWebImage, when I add the framework to xCode I keep getting the following error.

I have attempted to add the framework by clone the git repo

ld: framework not found SDWebImage
clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

Linking in Xcode requires a bit of work. We can tell what to do or suggest a better way. As I consider "dropping framework" solution a very bad habit, I'd strongly suggest a better way:

Use dependency manager!

This will help you to see whenever your dependencies get new updates. You'll also know which version are you using. This is a good practice.

You can eg use Cocoapods. Go to your Terminal, type:

$ sudo gem install cocoapods

Then go to your project folder (place, where you have xcodeproj) and type:

$ pod init

This creates a file named Podfile. Open it and paste:

platform :ios, '8.0' // or whatever you need
use_frameworks!

pod 'SDWebImage', '~> 3.7'

So when you have it ready, open Terminal and type:

$ pod install

From now you should work on xcworkspace instead od xcodeproj. Your dependency should work correctly.

BTW: There are many other solutions. You can simply use git submodules. You can also use Carthage. However most popular and as for me atm most convenient way is Cocoapods, so I wrote steps for this way.

0
On

You've added SDWebImage as a linked framework.

What you should be doing is adding it as an Embedded framework, and make sure that your build phase copies the framework into your app bundle.