Theo Strauss
Theo Strauss

Reputation: 1351

Library not loaded- Alamofire

I have been plagued by a bug for hours. I am building a framework using Alamofire and am testing it in an iOS project. Whenever I run the project, I get this error:

dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /Users/theodorestrauss/Library/Developer/Xcode/DerivedData/TGClient-ecnnvvvxipoufihfghkpxlfccyoc/Build/Products/Debug-iphonesimulator/TGClient.framework/TGClient Reason: image not found

I have scoured the web looking at GitHub issues, Stack articles, and more. I've cleaned, deleted Derived Data, added and deleted frameworks from embedded binaries, etc.

For anyone out there, this is not a duplicate. All other questions and answers are outdated.

If anyone can help, I'd immensely appreciate it. Thanks so much in advance. Cheers,

Theo

Upvotes: 6

Views: 9335

Answers (5)

Ryan110
Ryan110

Reputation: 740

I solve it by unchecking run script only when installing in build phases menu

Upvotes: 2

anoop4real
anoop4real

Reputation: 7708

I was getting this error while using Alamofire 4.5 + carthage, I added the framework as Linked Libraries in the build phase, the app was crashing on start. In XCode 9.1 I couldn't find the option of Embedded framework, so I added a Run Script to copy framework from Carthage and it started working. So basically this

  1. Add the framework to the build phases as you normally do.
  2. Add the below Run Script

/usr/local/bin/carthage copy-frameworks

$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework

Copy frameworks

Upvotes: 1

Mozahler
Mozahler

Reputation: 5303

This is what I do when I have this problem (and it really works!):

  1. Remove Alamofire framework from target/embedded libraries and target/linked frameworks and libraries by highlighting it and clicking the minus sign. (click on your project name in the upper left corner if you don't see these areas in the center of your screen).

  2. Perform a product clean (Shift-Cmd-K).

  3. In Embedded Binaries section, click on the + sign. Add Alamofire. (or drag the Alamofire icon from the left column into this section and drop it there)

  4. Xcode should fix everything, and it should now load onto the device properly.

FrameworkView

Upvotes: 1

Joe
Joe

Reputation: 4074

Make sure your build settings > Runpath search paths have be

• @executable_path/Frameworks
• $(inherited)

Also in your framework search path below entry is there

"$PODS_CONFIGURATION_BUILD_DIR/Alamofire"

Upvotes: 2

Sivajee Battina
Sivajee Battina

Reputation: 4174

Can you please clear derived data once and build the project again.

Here is how to clear derived data. Open the terminal and simply hit this command.

rm -rf ~/Library/Developer/Xcode/DerivedData

Upvotes: 1

Related Questions