CocoaPods refuses a Swift pod that depends on a pod without modules
The following Swift pods cannot yet be integrated as static libraries:Short answer
CocoaPods builds Swift pods as static libraries only if every pod they import defines a module. When a dependency such as an Objective-C pod does not, pod install stops. Enable modular headers for that pod, or for all pods, in the Podfile. For Firebase, building pods as frameworks with use_frameworks! is the other documented route.
Fix it fast
1Find out which cause you have
Read which pod depends on which. The message names both: the Swift pod, and the dependency that has no module. The second name is the one to fix.
cd ios pod install 2>&1 | grep -A4 "cannot yet be integrated"2Match what you see, then jump to its fix
What does the error look like?
The following Swift pods cannot yet be integrated as static libraries:... does not define modules.
Cause 1 of 2
A dependency does not define a module
1Check
CocoaPods lets Objective-C pods import each other with plain quoted imports, and those imports do not work with module maps. A Swift pod can only import another pod as a module. The validator reports the dependency that has none.
sed -n 1,60p Podfile2Fix
Opt that dependency into module map generation. Either set it for one pod by name, or turn it on for the whole target. Use the name from the error message.
# ios/Podfile, per pod
pod 'GoogleUtilities', :modular_headers => true
# or for every pod in the target
use_modular_headers!3Verify
Install again; the error is gone and Pods are generated.
cd ios
pod installConfirmed by blog.cocoapods.org
Cause 2 of 2
Pods are built as static libraries when Firebase expects frameworks
1Check
Without use_frameworks! CocoaPods builds every pod as a static library, which is what triggers the module requirement. Firebase documents two valid Podfile lines, one with dynamic and one with static linkage.
grep -n "use_frameworks\|use_modular_headers" ios/Podfile2Fix
Build pods as frameworks. The Firebase guide recommends static linkage unless you need dynamic behaviour; it needs CocoaPods 1.9.0 or newer.
# ios/Podfile, inside the Runner target
use_frameworks! :linkage => :static3Verify
Clean the Pods folder and install again.
cd ios
rm -rf Pods Podfile.lock
pod installConfirmed by firebase.google.com
How do I stop it coming back?
- When you add a pod, read the first lines of the pod install output; module problems are reported there, not at compile time.
- Pick one linkage style (modular headers or use_frameworks!) and keep it in the Podfile under version control.
- If a library must stay static, Firebase says some libraries cannot be linked dynamically; check its linkage page before choosing dynamic.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
- Dawlance AirA companion app for smart air conditioners, with IoT pairing across native and Flutter layers.
Related fixes
Mobile apps
flutter run on iOS or macOS stops with Error running pod install
Warning: CocoaPods not installed. Skipping pod install.
Flutter only reports that pod install failed; the reason is in the lines just above it.
5 causes, each with a fixMobile apps
Swift cannot import a module that is installed in the project
No such module 'Flutter'
The compiler for this target cannot see the module, even though the code exists on disk.
4 causes, each with a fixMobile apps
FirebaseMessaging.getAPNSToken() returns null on iOS
FirebaseMessaging.instance.getAPNSToken() returns null
getAPNSToken() gives null when iOS has not handed the app an APNs token yet or never will.
4 causes, each with a fixMobile apps
Xcode cannot find GoogleService-Info.plist for the Runner target
error: Build input file cannot be found: '/Users/GoogleService-Info.plist' (in target 'Runner' from project 'Runner')
Xcode's project file lists GoogleService-Info.plist as an input, but nothing exists at the path it records.
3 causes, each with a fixMobile apps
Firebase phone sign-in on iOS stops with 'Please register custom URL scheme'
Please register custom URL scheme com.googleusercontent.apps.123456789-abc in the app's Info.plist file.
Phone sign-in on iOS can open a reCAPTCHA page, and Firebase needs a URL scheme in Info.plist to return to your app.
2 causes, each with a fixMobile apps
Firebase on iOS asks for the FCM token before APNs has given one
Be sure to re-retrieve the FCM token once the APNS device token is set.
The Firebase Messaging SDK needs the APNs device token from iOS before it hands out an FCM token.
3 causes, each with a fix