xcodebuild: no such module on Dynamic Framework import

I have a project that includes a third-party dependency as an embedded dynamic framework. It builds in Xcode but not with xcodebuild.


Here's an example xcodebuild command that does *not* work if the embedded framework is added but would work if the framework is excluded.

xcodebuild -target TestLinkDynamic -configuration AdHoc clean build


The compilation error is: "error: no such module 'ModuleName'"


* "Defines Module" is set to YES for the third-party framework.

* The module .xcodeproj is included within the project xcodeproj in the project navigator.

* The module is added to Embedded Binaries in General, and in Target Dependencies, Link BInary with Libraries, and Embed Frameworks in Build Phases.


For this project, I get a successful build if I change the xcodebuild command to include '-sdk iphoneos', and also add either -project or -target AND -scheme. The resulting command looks like this:

xcodebuild -sdk iphoneos -project TestLinkDynamic.xcodeproj -scheme TestLinkDynamic -configuration AdHoc archive


However, the above solution is not working for another project that is set up with a dynamic framework (written in ObjC this time) in the same way. For that one, even with the -sdk line, I get the same "error: no such module 'ModuleName'"


Another possibly-related observation is if I import the embedded dynamic framework (Objective-C variety) in a bridging header instead of using 'import ModuleName', the xcodebuild command will succeed with the simplest version of the command that excludes the -sdk, -project, and -scheme.


I'm looking for insights on what I should expect to have to send the xcodebuild command to get a consistent successful build on projects that include embedded dynamic frameworks.


Why does passing -sdk, -project, and -scheme have an impact on building the project with an embedded framework included? Why might that work for one project but not for another very similar one?


What's the best way to set up the xcodebuild command for a project that includes an embedded framework?


Thanks!

Sean

Does the framework project have an AdHoc configuration, to match the scheme you are building the app project for? It sounds like this is working when building from Xcode because you are building for Debug or Release configuration in that case, which the framework project also has.

xcodebuild: no such module on Dynamic Framework import
 
 
Q