4
votes

I am migrating a "NetworkFoundation" Framework, which is based on Alamofire, to Swift 5. Carthage is being used as the dependency manager,

The cartfile looks the following:

github "Alamofire/Alamofire" "5.0.0-beta.5"

The command carthage update is executed with success. In Xcode the project builds, but when I run the command carthage build --no-skip-current in the root directory of my framework it fails:

xcodebuild output can be found in /var/folders/1m/qjb4gks13d54rqmn9ptwjmmw0000gp/T/carthage-xcodebuild.bg5VCR.log

Building scheme "Alamofire macOS" in Alamofire.xcworkspace

Building scheme "Alamofire tvOS" in Alamofire.xcworkspace

Building scheme "Alamofire watchOS" in Alamofire.xcworkspace

Building scheme "Alamofire iOS" in Alamofire.xcworkspace

Building scheme "MyNetworkFoundation" in MyNetworkFoundation.xcodeproj

Building scheme "Alamofire iOS" in Alamofire.xcworkspace

Build Failed

Task failed with exit code 65:

/usr/bin/xcrun xcodebuild -workspace /Users/MyUser/Documents/Projects/MyNetworkFoundation/MyNetworkFoundation/Carthage/Checkouts/Alamofire/Alamofire.xcworkspace -scheme Alamofire\ iOS -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/1m/qjb4gks13d54rqmn9ptwjmmw0000gp/T/MyNetworkFoundation SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/MyUser/Documents/Projects/MyNetworkFoundation)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/1m/qjb4gks13d54rqmn9ptwjmmw0000gp/T/carthage-xcodebuild.bg5VCR.log

As recommended, I checked the logfile of the failed build. In there it says:

error: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'Alamofire iOS') ** ARCHIVE FAILED **

So I checked the Swift Version of my Project which seems to be correct. MyNetworkFoundation Build Settings

Because the logfile states that the Swift Version 3.0 is used in target 'Alamofire iOS', I checked the targets in

/MyNetworkFoundation/Carthage/Checkouts/Alamofire/Alamofire.xcodeproj

but all of them have Swift Version 5. I have no idea what why that error is appearing when I want to build my project. I even tried re-installing Xcode but that did not work either. Anybody got an idea what I am missing?

Xcode Version: 10.2.1 (10E1001) MacOS Version: 10.14.5 (18F132)

1
what is your pod code to install Alamofire?Vinu Jacob

1 Answers

0
votes

Not sure if this will solve the issue for you but I was experiencing something similar. For me, since I just copied the repo of a project I was onboarding to, I was running carthage bootstrap and it always failed for Alamofire with Swift 3 errors like yours.

My Cartfile file has github "Alamofire/Alamofire" ~> 4.7.2, and my project is using Swift 4.2 (so again, not exactly the same as your setup).

I finally got it to work running the following command:

carthage bootstrap --platform iOS --no-use-binaries --toolchain com.apple.dt.toolchain.Swift_4_2

I believe the trick was to specify the toolchain use Swift 4.2, so I would suggest you try with Swift_5_0. Hope this helps!