3
votes

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
Can you please clear derived data once and check - Sivajee Battina
If this is while using the Xcode 9 betas to tvOS, update to beta 3. Otherwise you need to include more info (versions of everything, how you're integrating Alamofire, etc.) - Jon Shier
@JonShier I'm not, it's to iOS. I'm using Xcode 9 Beta, integrating Alamofire 4.4.0 with CocoaPods. I've pod installed in both my framework and my test ios project. I'm also using the iPhone 7+ simulator running iOS 11.0. If you have any more questions, please let me know! - Theo Strauss
Can you provide git link of your project ? I am interested in this ! - dip

5 Answers

1
votes

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"
1
votes

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

1
votes

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

0
votes

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
0
votes

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