Swift "No such module" in Xcode CI Builds
The Swift compiler could not resolve an import. The module exists in your dependency list but was not built or made visible to this build - usually because the wrong container was built or pods/packages were not resolved.
What this error means
Compilation fails on an import Foo line with "no such module 'Foo'". It is common in CI when the project (.xcodeproj) is built instead of the workspace, so CocoaPods/SPM modules are not on the search path.
/Users/runner/App/AppDelegate.swift:3:8: error: no such module 'Alamofire'
import Alamofire
^Diagnose it: SDK, signing, or simulator?
Mobile CI failures cluster into three: a missing or mismatched SDK component, a code-signing identity that does not exist on the runner, or a simulator or emulator that never became ready.
# Android
sdkmanager --list_installed 2>/dev/null | head
echo "ANDROID_HOME=$ANDROID_HOME"
adb devices
# iOS
xcodebuild -version && xcrun simctl list devices available | head
security find-identity -v -p codesigningCommon causes
Building the project instead of the workspace
CocoaPods integrates through the .xcworkspace. Building -project App.xcodeproj skips the Pods project, so pod modules are missing.
Dependencies not resolved before building
If pod install or SPM resolution did not run (or its cache was stale), the module was never built and cannot be imported.
How to fix it
Build the workspace, not the project
xcodebuild -workspace App.xcworkspace -scheme App build
# not: xcodebuild -project App.xcodeproj ...Resolve dependencies before building
Install pods and/or resolve Swift packages first so the modules exist.
pod install
xcodebuild -resolvePackageDependencies -workspace App.xcworkspace -scheme AppCheck the module name and target membership
- Confirm the import name matches the framework’s product/module name.
- Ensure the dependency is added to the target that imports it.
- Clean derived data if a stale build is masking a resolved module.
How to prevent it
- Always reference the
.xcworkspacewhen CocoaPods is used. - Run
pod install/-resolvePackageDependenciesas an explicit CI step. - Commit
Podfile.lock/Package.resolvedso versions are reproducible.