I am working with Swift 4.2 and Xcode 10.1. I am trying to build a framework in Swift that depends on Alamofire which is written in Objective C. I added the Alamofire.xcodeproj manually as given in the README by Alamofire. The individual target builds fine. My Framework target builds fine.
The problem arises when I try to create a fat framework using a script that uses the following command
xcodebuild -project "${FRAMEWORK_NAME}.xcodeproj" -scheme "${FRAMEWORK_NAME}" -configuration "${CONFIGURATION}" -arch arm64 -arch armv7 -arch armv7s only_active_arch=no BITCODE_GENERATION_MODE=bitcode defines_module=yes -sdk "iphoneos" -derivedDataPath "${OUTPUT_DIR}"
I get the following error:
umbrella header 'Alamofire.h' not found
could not build Objective-C module 'Alamofire'
The second line of the error is coming from another dependency 'Moya' that depends on Alamofire (See Image)
It's puzzling that normal Cmd+B works fine for usual target but xcodebuild fails.
Things that I attempted:
- Deleting Derived folder, Clean Build.
- Building individual dependencies first and then build the Universal Aggregated Target.
- Creating a custom module map
- Changing configurations of all dependencies to same e.g. Debug
- Changing Swift Language Version of Alamofire.xcodeproj to be Swift 4.2
I think xcodebuild command needs more input. What am I missing?
Updates:
I dig in further. The Headers folder
inside Debug-iphoneos/Alamofire.framework/ is empty which it is expected to contain umbrella header Alamofire.h.