xcodebuild fails to create Archive due to SymLink error with Alamofire

2.2k Views Asked by At

This is really winding me up now, all I am trying to do is an Xcode CLI build using the Xcode command line tools.

The flow is as follows:

  • App Code is cloned from Git
  • Info Plist and my own custom plist are generated and copied to project folder
  • A new app icon set copied over into the assets directory
  • Xcode Archive build is executed
  • Xcode generate IPA build is executed

The issue is the Archive part keeps failing, and I cannot get it working. Annoyingly it works fine if I open the project in Xcode and Archive it through there, but that defeats the point of this automated process.

This is the command xcodebuild -verbose -scheme EpicHRV1.1.0 -archivePath ios/app.xcarchive archive

And here is the constant resultant error. I really can't figure out what its complaining about, I mean, it says something to do with Alamofire and missing modules, but why would this work in Xcode but not the command line?

Command failed: xcodebuild -verbose -scheme EpicHRV1.1.0 -archivePath ios/app.xcarchive archive 2017-01-07 20:24:04.255 xcodebuild[43780:2460638] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-11754/DVTFoundation/Utilities/DVTFileSystemUtilities.mm:142 Details: lstat('/Users/Justin/Library/Developer/Xcode/DerivedData/EpicHR-dgdtmzwowkyxgkfzmizhuhiaxkrt/Build/Intermediates/ArchiveIntermediates/EpicHRV1.1.0/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework/Modules') failed with errno 2 (No such file or directory) Function: DVTRecursiveMkdirResult dvt_recursiveMkdir_returningErrorString(NSString *__strong, NSString *__autoreleasing *) Thread: <NSThread: 0x7f90e8ae7cf0>{number = 7, name = (null)} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide. ** ARCHIVE FAILED **

Here is another lovely error which also randomly appears, but not every time...

The following build commands failed: SymLink /Users/Justin/Library/Developer/Xcode/DerivedData/EpicHR-dgdtmzwowkyxgkfzmizhuhiaxkrt/Build/Intermediates/ArchiveIntermediates/EpicHRV1.1.0/BuildProductsPath/Release-iphoneos/Alamofire.framework /Users/Justin/Library/Developer/Xcode/DerivedData/EpicHR-dgdtmzwowkyxgkfzmizhuhiaxkrt/Build/Intermediates/ArchiveIntermediates/EpicHRV1.1.0/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework

And another error that sometimes appears. With all of the above the only consistent thing is Alamofire is mentioned in the error..

The following build commands failed: Strip /Users/Justin/Library/Developer/Xcode/DerivedData/EpicHR-dgdtmzwowkyxgkfzmizhuhiaxkrt/Build/Intermediates/ArchiveIntermediates/EpicHRV1.1.0/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework/Alamofire

1

There are 1 best solutions below

3
On

So I solved it with the following commands:

xcodebuild -scheme EpicHRV1.1.0 -archivePath ../ios/app.xcarchive archive

xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath ../ios/app.xcarchive -exportPath ../ios/ipa/