Library not loaded- Alamofire

Viewed 5358

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

5 Answers

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

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

Related