Reputation: 42489
I'm having trouble Archiving an Aggregate Target. My app is set up like so:
All of the targets share the same core set of files: Launch Storyboard, AppDelegate, UIViewController subclass, Storyboard, Asset Catalog. They all have unique info.plist files.
Adding an aggregate target and building it works perfectly. I can also Archive it no problem the first time. Only after I try a second archive do I get errors when the CopySwiftLibs
command is run:
*** error: Couldn't copy/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib to /Users/jal/Library/Developer/Xcode/DerivedData/MyApp-enstrypfbpojoqgbavkrccebdjsi/Build/Intermediates/ArchiveIntermediates/BuildAllEnterprise/BuildProductsPath/SwiftSupport/iphoneos/libswiftCore.dylib: A file with the name “libswiftCore.dylib” already exists.
It's not always the same dylib. Sometimes it's libswiftDarwin.dylib
, other times it's libswiftUIKit.dylib
. I assume this issue occurs because the Swift libraries are being copied to the Derived Data folder by one target in the aggregate, and the build script is attempting to copy duplicate libraries for subsequent targets in my aggregate.
I've had varied success cleaning my build folder/deleting Derived Data/restarting Xcode or my Mac. But even if I can get the target to Archive properly once, it always fails the second time.
How can I prevent this when Archiving my Aggregate Target?
Upvotes: 1
Views: 1247
Reputation: 42489
Finally figured this out. The builds were running in parallel, stepping on each other during the CopySwiftLibs
phase. Unchecking "Parallelize Build" under my aggregate target scheme's Build settings fixed the issue.
Upvotes: 3