Xcode complains "No such module" even though the framework is in place: what to do?

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

"No such module": a familiar nightmare for every Swift developer

\n\n

You add a framework via SPM, CocoaPods, or manually, you see it in the Project Navigator, everything looks perfect — but Xcode stubbornly writes: No such module 'Alamofire' (or any other module). Sound familiar? If yes — you are not alone. The original question on Stack Overflow has gathered tens of thousands of views, and the comments have turned into a real collection of iOS developers' pain.

\n\n

In this article, we will break down 10 real reasons why the No such module error occurs and show how to fix them. At the end, a checklist awaits you that will save hours of nerves.

\n\n

Why doesn't Xcode see the module? Top 10 reasons

\n\n

1. Derived Data — the main culprit

\n

Xcode caches project information in the Derived Data folder. If the cache is outdated or corrupted, the compiler "forgets" about the connected modules. This is the first thing to check.

\n\n

How to fix:

\n
    \n
  • Close Xcode
  • \n
  • Open the terminal and run:\n
    rm -rf ~/Library/Developer/Xcode/DerivedData
    \n
  • \n
  • Or manually: Xcode → Preferences → Locations → Derived Data → click the arrow → delete the folder
  • \n
  • Restart Xcode and do Cmd + B
  • \n
\n\n

2. Incorrect Build Phases configuration

\n

Even if the framework physically exists in the project, Xcode may not know that it needs to be linked. Check Link Binary With Libraries:

\n
    \n
  • Select the target → Build Phases
  • \n
  • Expand Link Binary With Libraries
  • \n
  • Make sure your framework is there
  • \n
  • If not — click + and add it
  • \n
\n\n

3. Swift Package Manager: wrong branch or version

\n

SPM is a convenient tool, but it is sensitive to versions. If you specified from: "1.0.0", but the repository has version 2.0.0, Xcode may not find a compatible module.

\n\n
// Example Package.swift\ndependencies: [\n    .package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.6.0")\n]
\n\n

What to do:

\n
    \n
  • Go to File → Packages → Update to Latest Package Versions
  • \n
  • If the problem persists — delete the framework and add it again
  • \n
  • Check Package Dependencies in the project — the module should be green
  • \n
\n\n

4. Architecture conflict (Architectures)

\n

Old frameworks may be built only for arm64, while your project includes a simulator (x86_64). With the advent of Apple Silicon, this has become a common cause.

\n\n

Solution: Add to Build Settings → Excluded Architectures for the Debug build:

\n
    \n
  • For simulator: arm64
  • \n
  • For device: $(ARCHS_STANDARD)
  • \n
\n\n

5. Incorrect search path (Framework Search Paths)

\n

If you are adding a framework manually, Xcode needs to know where to find it. Check Framework Search Paths:

\n
    \n
  • Build Settings → Framework Search Paths
  • \n
  • Make sure the path leads to the folder with .framework or .xcframework
  • \n
  • For SPM, nothing usually needs to be specified, but for manual frameworks — it is mandatory
  • \n
\n\n

6. Framework not added to all targets

\n

A project may have several targets (main app, widgets, extensions). If you added the module only to one, other targets will not see it.

\n\n

Check: Select the framework in Project Navigator → inspector on the right → Target Membership — check all the necessary targets.

\n\n

7. Problems with CocoaPods (if you use it)

\n

CocoaPods is a classic, but sometimes after pod install the framework is not picked up

Blogs

Book Recommendations