Moya: Alamofire linker errors (Carthage)

Created on 7 Aug 2017  路  2Comments  路  Source: Moya/Moya

I added Moya to my Cartfile:

github "Moya/Moya"
carthage update Moya

Then I added code from Basic Usage to my project. It doesn't build (screenshot with errors is at the end).

There seem to be a problem with the Alamofire dependency.

This happens using the simulator. I haven't tested on a device yet (also can't do this right now).

I also tried to add Alamofire directly to the Cartfile, and use e.g. Alamofire.URLEncoding.default instead of the typealias provided by Moya, but in that case I get "dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire".

This is my output of carthage update Moya (without the explicit Alamofire dependency)

* Fetching ReactiveCocoa
Fetching Moya
Fetching Fakery
Fetching Log
Fetching ReactiveSwift
Fetching Nimble
Fetching ReactiveReSwift
Fetching Quick
Fetching Result
Fetching Alamofire
Fetching RxSwift
Checking out Alamofire at "4.5.0"
Checking out ReactiveSwift at "1.1.5"
Checking out Moya at "8.0.5"
Downloading RxSwift.framework binary at "Oxygen.1"
Checking out Result at "3.2.3"
xcodebuild output can be found in /var/folders/ck/lyyjs8_101dgf9tc411z5rdc0000gn/T/carthage-xcodebuild.DEBmCu.log
Building scheme "Alamofire macOS" in Alamofire.xcworkspace
Building scheme "Alamofire iOS" in Alamofire.xcworkspace
Building scheme "Alamofire watchOS" in Alamofire.xcworkspace
Building scheme "Alamofire tvOS" in Alamofire.xcworkspace
Building scheme "Result-Mac" in Result.xcodeproj
Building scheme "Result-iOS" in Result.xcodeproj
Building scheme "Result-tvOS" in Result.xcodeproj
Building scheme "Result-watchOS" in Result.xcodeproj
Building scheme "ReactiveSwift-macOS" in ReactiveSwift.xcworkspace
Building scheme "ReactiveSwift-iOS" in ReactiveSwift.xcworkspace
Building scheme "ReactiveSwift-tvOS" in ReactiveSwift.xcworkspace
Building scheme "ReactiveSwift-watchOS" in ReactiveSwift.xcworkspace
Building scheme "Moya" in Moya.xcodeproj
Building scheme "RxMoya" in Moya.xcodeproj
*
Building scheme "ReactiveMoya" in Moya.xcodeproj

Here also a screenshot with the errors:
screen shot 2017-08-07 at 15 03 27

carthage

Most helpful comment

Update: I forgot to add the path to the copy-frameworks script. Reset the Carthage setup and downloading Moya (without explicit Alamofire) again (it takes forever...), will write again when I can test it.

Update 2: No it doesn't work only with Moya, will try again adding Alamofire...

Update 3: Ok, I got it working:

  1. Add (only) Moya to Cartfile.

  2. Add the frameworks of Moya and dependencies to "Linked frameworks and libraries".

  3. Add the paths to Moya and dependencies frameworks to the copy-frameworks script.

All 2 comments

Update: I forgot to add the path to the copy-frameworks script. Reset the Carthage setup and downloading Moya (without explicit Alamofire) again (it takes forever...), will write again when I can test it.

Update 2: No it doesn't work only with Moya, will try again adding Alamofire...

Update 3: Ok, I got it working:

  1. Add (only) Moya to Cartfile.

  2. Add the frameworks of Moya and dependencies to "Linked frameworks and libraries".

  3. Add the paths to Moya and dependencies frameworks to the copy-frameworks script.

Hey @i-schuetz. Thank you for writing a complete guide how to fix the issue you encountered! :D This surely will help people with similar problems in the future, so again thank you for doing this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoeFerrucci picture JoeFerrucci  路  3Comments

fenixsolorzano picture fenixsolorzano  路  3Comments

GurpalRajput picture GurpalRajput  路  3Comments

hjzCy picture hjzCy  路  3Comments

pedrovereza picture pedrovereza  路  3Comments