Xcode cannot find the Firebase module inside a framework or library
No such module 'Firebase'Short answer
A target only sees the pods declared for it. If a library or framework target imports Firebase, the Podfile must list the pod inside that target, or the library's podspec must declare it as a dependency. Also open the .xcworkspace, not the .xcodeproj, and run pod install again.
Fix it fast
1Find out which cause you have
Check which target fails, and whether the Podfile names that target. Then confirm you opened the workspace.
cat Podfile ls -d *.xcworkspace2Match what you see, then jump to its fix
- 1
The build fails on the first import, and the Pods project does not appear in Xcode's navigatorThe project was opened instead of the workspaceFix - 2
Firebase pods are declared only in the app target, and the import fails in the library targetThe library target is not listed in the PodfileFix - 3
The library has its own .podspec, and consumers get No such module 'Firebase'The library ships as a pod, but its podspec lacks the dependencyFix
- 1
What does the error look like?
No such module 'Firebase'
Cause 1 of 3
The project was opened instead of the workspace
1Check
Firebase's setup guide tells you to open the .xcworkspace file, not the .xcodeproj, after pod install.
ls -d *.xcworkspace *.xcodeproj2Fix
Close the project and open the workspace.
open MyApp.xcworkspace3Verify
The Pods project appears next to your project in the navigator, and the module is found on the next build.
xcodebuild -workspace MyApp.xcworkspace -scheme MyLibrary -destination 'generic/platform=iOS Simulator' buildConfirmed by firebase.google.com
Cause 2 of 3
The library target is not listed in the Podfile
1Check
Pods declared inside a target block apply only to that target. A framework target in the same workspace gets nothing from the app's block unless it is nested or shares an abstract target.
grep -n "target\|pod " Podfile2Fix
Declare the pod in the library target's block, or share the pods with an abstract target.
use_frameworks!
abstract_target 'Shared' do
pod 'FirebaseAuth'
target 'MyApp'
target 'MyLibrary'
end3Verify
Reinstall the pods and rebuild the library scheme.
pod installConfirmed by guides.cocoapods.org
Cause 3 of 3
The library ships as a pod, but its podspec lacks the dependency
1Check
A pod's dependencies are declared in its podspec. If the code imports Firebase but the podspec does not name the pod, the consumer's build does not link or find it.
grep -n "dependency" *.podspec2Fix
Add the dependency with a version requirement. The docs recommend the optimistic operator so the pod stays compatible with others.
s.dependency 'FirebaseAuth', '~> 11.0' # example version, use the one you build against3Verify
Run pod install in a project that consumes the library and build it.
pod installConfirmed by guides.cocoapods.org
How do I stop it coming back?
- Open the .xcworkspace as the only way into the project, and delete the habit of opening the .xcodeproj.
- Whenever you add a target, add it to the Podfile in the same commit.
- Check the Firebase setup page for the linkage rule (static or dynamic) before changing use_frameworks!.
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
Xcode cannot find FirebaseCore.h even though Firebase is installed
'FirebaseCore/FirebaseCore.h' file not found
The compiler only finds Firebase headers when the build uses the CocoaPods setup.
3 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 fixMobile apps
A test push from the Firebase console never shows up on the iPhone
didReceiveRegistrationToken prints a token, yet no notification arrives
When a console message is accepted but the iPhone stays silent, the break is between Firebase and APNs or inside the app.
4 causes, each with a fixMobile apps
InstanceID token() no longer works in a Swift Firebase app
Instance ID calls fail to compile after upgrading Firebase to 8.0.0 or later
Firebase removed the Instance ID dependency from Messaging in 8.0.0, so InstanceID.instanceID() calls no longer belong in a current app.
3 causes, each with a fixMobile apps
CocoaPods refuses a Swift pod that depends on a pod without modules
... does not define modules.
CocoaPods builds Swift pods as static libraries only if every pod they import defines a module.
2 causes, each with a fixMobile apps
Xcode builds no dSYM for the app, so Crashlytics shows missing dSYMs
error: Info.plist Error Unable to process Info.plist
Crashlytics needs a dSYM from every build.
4 causes, each with a fix