Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Swift cannot import a module that is installed in the project

ErrorNo such module 'Firebase'

Short answer

The compiler for this target cannot see the module, even though the code exists on disk. That means the build was started without the pod integration (a .xcodeproj opened instead of the .xcworkspace), the pod or package is attached to another target, or the Pods folder is out of date. Check which file Xcode has open and which target fails, then fix that link.

  • Applies to Xcode 26, CocoaPods 1.17, Flutter 3.44 stable, Swift packages in Xcode 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out three things: which project file the build uses, whether the Pods folder exists, and which target shows the error. The line starting with the file path in the error tells you the target; the first command shows what is on disk.

    ls -d ios/*.xcworkspace ios/*.xcodeproj ios/Pods ios/Podfile.lock
    grep -n "target\|inherit" ios/Podfile
  2. 2Match what you see, then jump to its fix

    1. 1The window title or the build log shows Runner.xcodeproj, a Pods folder exists, and every pod import failsThe project was opened as .xcodeproj, not .xcworkspaceFix
    2. 2The app target builds, but a test, extension or widget target reports No such module for a pod the app usesThe pod is declared for another target, or a test or extension target does not inherit itFix
    3. 3ios/Pods does not exist (fresh clone, flutter clean, or a deleted folder) or Podfile.lock lists a pod that Pods/ does not containThe Pods folder is missing or older than Podfile.lockFix
    4. 4The package shows under Package Dependencies, yet one target cannot import it; the target's Frameworks, Libraries, and Embedded Content list does not show the productA Swift package is in the project but its product is not linked to this targetFix

What does the error look like?

  • No such module 'Firebase'
  • No such module 'Flutter'
  • error: no such module 'SomePod' in a test, extension or widget target

Cause 1 of 4

The project was opened as .xcodeproj, not .xcworkspace

1Check

CocoaPods builds the pods in a second project and joins both in a workspace. Only the workspace knows about the pod targets and their module search paths. The CocoaPods troubleshooting guide tells you to open the .xcworkspace, not the .xcodeproj, when Xcode builds fail with pods.

ls ios/*.xcworkspace
ps aux | grep -i "[X]code.app" | head -1

2Fix

Close the project and open the workspace file. For Flutter, build from the terminal or open the workspace from the ios folder. With xcodebuild pass -workspace, not -project.

open ios/Runner.xcworkspace
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -sdk iphonesimulator build

3Verify

The build log lists Pods targets and the import error is gone.

xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -sdk iphonesimulator build 2>&1 | grep -c "No such module"

Confirmed by guides.cocoapods.org

Did this fix it?

Cause 2 of 4

The pod is declared for another target, or a test or extension target does not inherit it

1Check

Each target block in the Podfile belongs to one Xcode target, and by default it inherits only what is declared above it. A new target that has no block gets no pods at all. A test target needs the app's pods on its search path, which the Podfile expresses with inherit! :search_paths. Compare the Podfile with the target list.

xcodebuild -project ios/Runner.xcodeproj -list
cat ios/Podfile

2Fix

Add a target block for the failing target, listing the pods it imports, or for a test target nest it in the app's block with search-path inheritance. Then install again so CocoaPods rewrites the target's settings.

target 'Runner' do
  pod 'SomePod'
  target 'RunnerTests' do
    inherit! :search_paths
  end
end
# then
cd ios && pod install

3Verify

pod install finishes without errors and the failing target now compiles.

cd ios && pod install
xcodebuild -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator build 2>&1 | grep -c "No such module"

Confirmed by guides.cocoapods.org

Did this fix it?

Cause 3 of 4

The Pods folder is missing or older than Podfile.lock

1Check

pod install creates the Pods project and records versions in Podfile.lock. If the folder is gone or was made from another Podfile, the module is not built. For a Flutter app, pub get also has to run first, because the plugin list comes from it.

ls ios/Pods | head -3
diff ios/Podfile.lock ios/Pods/Manifest.lock && echo same

2Fix

Run pub get and then install the pods again. If a pod's version must change, use pod update with the pod's name; plain pod install keeps the versions in Podfile.lock.

flutter pub get
cd ios && pod install

3Verify

Manifest.lock matches Podfile.lock and the module builds.

diff ios/Podfile.lock ios/Pods/Manifest.lock && echo same
flutter build ios --no-codesign

Confirmed by guides.cocoapods.org

Did this fix it?

Cause 4 of 4

A Swift package is in the project but its product is not linked to this target

1Check

Adding a package asks which products go to which targets; a package alone is not linked anywhere. A product linked to the app target is not automatically available to a test or extension target. Look at the target's linked products in the project file.

grep -n "packageProductDependencies" ios/Runner.xcodeproj/project.pbxproj
xcodebuild -project ios/Runner.xcodeproj -list

2Fix

Select the failing target, open General, and under Frameworks, Libraries, and Embedded Content press + and add the package product. Add it for each target that imports it.

# Xcode: target > General > Frameworks, Libraries, and Embedded Content > +
# then check the product is listed for that target
grep -n "productName" ios/Runner.xcodeproj/project.pbxproj

3Verify

The product is listed for the failing target and the import resolves.

xcodebuild -project ios/Runner.xcodeproj -scheme Runner -sdk iphonesimulator build 2>&1 | grep -c "No such module"

Confirmed by developer.apple.com

Did this fix it?

How do I stop it coming back?

  • Open the workspace, never the project, in any CocoaPods project; keep a short note in the README.
  • When you add an app extension or test target, add its target block to the Podfile in the same commit and run pod install.
  • Commit Podfile.lock so every machine builds the same pods.
  • After flutter clean, run flutter pub get and pod install before opening Xcode.

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:

Related fixes

Mobile 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.