ios – Getting error “No such module” using Xcode, but the framework is there

The Question :

366 people think this question is useful

I’m currently coding in Swift, and I’ve got an error:

No such module Social

But I don’t understand, because the module is in my project, declared in “Linked frameworks and Libraries” and in “Embedded Binaries”.

The frameworks is in Objective-C, so I wrote a Bridge Header for it.

Please, how can I make Xcode recognize the framework?

Error module


Linkes Frameworks, Libraries

Header bridge

The Question Comments :
  • Not to be too mr. obvious but have you tried a full clean and build?
  • If the framework header is already included in the bridging header file then you don’t have to import it in the Swift source file.
  • Also you might have to use quotations marks for the import: #import "Social/Social.h"
  • same error with CocoaPods ‘no such module error’ in xcode.
  • I changed Deployment Target from 11 to 10, but forget it in Podfile platform :ios, '10.0'. That was solution.

The Answer 1

341 people think this answer is useful

I’m not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.

The Answer 2

594 people think this answer is useful

In case it’s Friday afternoon or anytime after 1am:

Opening xcodeproj instead of xcworkspace will cause an error like this…

The Answer 3

65 people think this answer is useful

Make sure that the naming of you configurations in the sub projects matches that of the “parent” project. If the configuration naming don’t match exactly (case-sensitive), Xcode will abort the archive process and show the error “No such module …”

That is, if you have a “parent” project with a configuration named “AppStore” you must make sure that all subprojects also have this configuration name.

See my attached screenshots.

Configuration setup in "parent" project

Configuration setup in 1st sub project

Configuration setup in 2nd sub project

The Answer 4

46 people think this answer is useful

I am not quite sure why Martin R‘s answer in the comments for the question is so disregarded:

Make sure that you tried simply skipping import of the framework as it is already added with the bridging header.

Hope this helps

The Answer 5

38 people think this answer is useful

I had the same issue using Cocoapods and Swift. I didn’t notice the following lines in the Podfile:

# Uncomment this line if you're using Swift
# use_frameworks!

So, all I had to do was change it to:

# Uncomment this line if you're using Swift

…aaand it worked 🙂

The Answer 6

22 people think this answer is useful

Please compare this screenshot with your build setting. It may this work. Go to the framework search path:

Enter image description here

The Answer 7

21 people think this answer is useful

The following steps worked for me.

  1. Quit xcode
  2. Run "pod update" in terminal
  3. Open .xcworkspace and build again.

The Answer 8

18 people think this answer is useful

I was experiencing this problem as well. The fix for me was that the Archive schemes between the two projects didn’t match. I have an xcworkspace with a framework project and an app project. The problem was that in the Archive scheme for my app, I was using a different Build Configuration than the framework was using for it’s Archive scheme. I set both Build Configurations to Release, and that fixed the issue.

The Answer 9

15 people think this answer is useful

In my case, after many attempts to figure out what I was doing wrong importing a framework I eventually discovered that the framework itself was the problem. If you are not getting your framework from a trusted source you should inspect the framework and ensure that it contains a Modules folder with a module.modulemap file inside it. If module.modulemap is not present, you will get the “No such module ‘MyFramework'” error.

Example showing directory structure of SwiftyJSON.framework

If the Modules folder is missing the “MyFramework.swiftmodule” folder then the framework will be found but Xcode won’t know about its contents so you will get different errors.

The Answer 10

12 people think this answer is useful

Assuming the Framework really is there and in the path, etc… delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory (and clean the project and delete the project-specific derived data for good measure).

When you do the standard cleanup, the ModuleCache directory doesn’t get rebuilt.

The Answer 11

11 people think this answer is useful

What worked for me is this solution to another question. Closing Xcode and reopening the project as workspace.
Go to your project folder and open .xcodeworkspace file.
Once you open the workspace (instead of project), Pods should appear as top level project in Project Navigator.

The Answer 12

10 people think this answer is useful

Be sure, that Find implicit Dependencies in Build options in Scheme is on!

The Answer 13

7 people think this answer is useful

I also encountered the same error a few days back. Here’s how I resolved the problem:

The error is “module not found”

  • Create Podfile in your root project directory
  • Install cocoapods (a dependency manager for Swift and iOS projects)
  • Run pod install
  • Go to Project Build Settings:

    • Find Objective-c bridging Header under Swift compiler – Code Generation (If you don’t find Swift compiler here, probably add a new Swift file to the project)
    • Drag and drop the library header file from left side to bridging header (see image attached)enter image description here
  • Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above)

  • In TestProject-Bridging-Header.h file, write #import “Mixpanel/Mixpanel.h”
  • In your Swift file the code should be: Import Mixpanel (i.e name of library)

That’s all.

The Answer 14

7 people think this answer is useful

There are several potential misconfigurations the issue can arise for,

  1. Please confirm that you have opened the .xcworkspace but not .xcodeproj file. Also make sure you have build Social first before you build TriviaApp.
  2. Make sure that iOS Deployment Target is set same for all modules with main app. For example is TriviaApps deployment target is set to 9.0, Socials deployment target also need to be set to 9.0.
  3. Make sure your main module (TriviaApp) and your used framework (Social) have same set of configurations. i.e. If your Project has three configurations, Debug, Release, ReleasePremium than your Social framework also need to have three configurations Debug, Release, ReleasePremium. Also make sure that the archive configuration is set same for both TriviaApp and Social. i.e. if your TriviaApps archive scheme is set to ReleasePremium, your Socials archive scheme also need to be set into ReleasePremium.
  4. Please assure that you do not need to import Social in each .swift files when its already added in the Bridging-Header.h.
  5. In case of issue came from Pod files, make sure you have uncommented #use_frameworks! into use_frameworks! from you Podfile. Sometime re installing pod works if Social has any dependency on pods.
  6. If none of the above steps works, delete your derived data folder and try re building.

The Answer 15

6 people think this answer is useful

Ok, how the same problem was resolved for me was to set the derived data location relative to the workspace directory rather than keeping it default. Go to preferences in xcode. Go to locations tab in preferences and set Derived data to Relative. Hope it helps.

The Answer 16

5 people think this answer is useful

I was getting same error for

import Firebase

But then noticed that I was not adding pod to the main target section but only adding to Test and TestUI targets in Podfile.

With the command

pod init

for an xcode swift project, the following Podfile is generated

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MyApp' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks

  # Pods for MyApp

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing

  target 'MyAppUITests' do
    inherit! :search_paths
    # Pods for testing


So, need to make sure that one adds pods to any appropriate placeholder.

The Answer 17

5 people think this answer is useful

If you’re building for a platform like tvOS, make sure you have an Apple TV (i.e. matching) simulator selected.

Building a tvOS app with an iOS simulator selected gave me exactly this error. Spent the better part of an hour looking for all sorts of build issues… doh.

The Answer 18

5 people think this answer is useful

In my case the app the IPHONEOS_DEPLOYMENT_TARGET was set to 9.3 whereas in my newly created framework it was set to 10.2

The implicit dependencies resolver ignored my new framework because the requirements of the target platform are higher than the app requirements.

After adjusting the framework iOS Deployment Target to match my application deployment target the framework compiled and linked successfully.

The Answer 19

4 people think this answer is useful

I was getting the same error as i added couple of frameworks using Cocoapods. If we are using Pods in our project, we should use xcodeworkspace instead of xcodeproject. To run the project through xcodebuild, i added -workspace <workspacename> parameter in xcodebuild command and it worked perfectly.

The Answer 20

3 people think this answer is useful

I found that the Import Paths in the Build Settings was wrong for a custom (MySQL) module. After pointing that to the right direction the message was gone.

The Answer 21

3 people think this answer is useful

I fixed this with

Targets -> General -> Linked frameworks and libraries

Add the framework which should be at the top in the Workspace folder. Pain in the arse.

The Answer 22

3 people think this answer is useful

I just deleted my cocoapod. Then, I did a pod install to remove it. Then, I just added it back into my podfile and re-installed it. That made it work. Not sure why.

The Answer 23

3 people think this answer is useful

I had already installed pods. Build worked without any problems when I builded application on my device, but archive didn’t work. I just run:

pod install

no new pods were installed, just .xcodeproj file got regenerated and archive started working

The Answer 24

3 people think this answer is useful

In General => Linked Frameworks and Libraries, I added my ./Pods/Pods.xcodeproj and it did the trick

The Answer 25

3 people think this answer is useful

In Xcode 10.1 the solution for me was to change the build system on Workspace Settings in the File menu. It is by default set to New Build System, changed that to Legacy Build System and that did the trick.

enter image description here

The Answer 26

3 people think this answer is useful

Sometimes pod deintegrate and then pod install helps me, too.

The Answer 27

3 people think this answer is useful

TL;DR: Check your Podfile for target-specific shared_pods

After beating my head against the wall and trying literally every single other answer posted here over the last week, I finally found a solution.

I have two separate targets – one for release and one for development. The development target was created long after the release target, which lead me to forget some setup steps for that target.

I was able to get my project to compile properly using my release target, but my development target was having an issue.

After looking at my Podfile for the twentieth time, I noticed that I only had the following, under my shared_pods definition:

target 'Release' do

What I needed to do was add my second target to my Podfile, and that fixed the issue:

target 'Release' do

target 'Development' do

Hopefully this saves someone a few days of frustration.

The Answer 28

3 people think this answer is useful

It is compile time error. You can get it in a lot of case:

  • .xcodeproj was opened instead of .xcworkspace

  • module.modulemap

Objective-C, Library/Framework Target.

If you host your own library or framework please make sure that it has module.modulemap file and the headers from it are located in Build Phases -> Headers section

Framework Search Paths

consumer -> framework

If you try to build an app without setting the Framework Search Paths. After setting the Framework Search Path to point to the framework resources, Xcode will build the project successfully. However, when you run the app in the Simulator, there is a crash for reason: Image not foundabout

It can be an absolute path or a relative path like $(SRCROOT) or $(SRCROOT)/.. for workspace

Import Paths

Swift consumer -> Swift static library

The Import Paths should point to .swiftmodule

Linked Frameworks and Libraries

consumer -> static framework

Add a Static framework to this section

Find Implicit Dependencies

When you have an implicit dependency but Find Implicit Dependencies was turned off


pod deintegrate
pod install

[Recursive path]

The Answer 29

2 people think this answer is useful

My issue was with multiple targets. I solved it with below links: configure pod file right way and fix build settings

Hope some one will find it helpful.

The Answer 30

2 people think this answer is useful

If you are using Carthage, the frameworks in building setting usually stay in


If you run carthage update --platform ios --no-build (to save time) the files inside Build folder will not be reacreated, then the modules will no available to XCode.

In my case, I have run carthage update --platform ios, then my problem was solved.

Tags:, ,

Add a Comment