Getting error "No such module" using Xcode, but the framework is there
Asked Answered
C

87

545

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

Project

Linkes Frameworks, Libraries

Header bridge

Coupe answered 7/4, 2015 at 19:59 Comment(18)
Not to be too mr. obvious but have you tried a full clean and build?Stoat
That was my first reaction :)Coupe
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.Hayne
You are right, it was just a "desesperate code", because nothing worked.Coupe
Also you might have to use quotations marks for the import: #import "Social/Social.h"Hayne
It can't be because Social is a framework so it is with <>, but I tried what you said and it doesn't work at all :/Coupe
Using Xcode 8.1, I got the same issue. Problem was, the framework was build with Swift 3.0 instead of 3.0.1 ;-)Bagnio
I have faced this issue in watch app and resolved it by: stackoverflow.com/questions/39944607/…Korman
Watch your derive data and check that the framework is being copied into your /Frameworks folder under your project in the iphonesimulator. If it's not, then you're not properly linking it or the binary is not compatible. If it is, then it's a path problem and you need to check your framework search paths.Carbamidine
I changed Deployment Target from 11 to 10, but forget it in Podfile platform :ios, '10.0'. That was solution.Phalansterian
pod install it worked for me.Autolysis
A very simple problem can be that: when you drag the framework from say your desktop in to Xcode, it does NOT copy it to the relevant project directory, but just leaves it on the desktop. Ensure you have "copy to location ..." when you drag it in!Fahland
I was stuck on this problem with XCode 10.3, I think I've tried all the solutions I found on the internet and in this thread for about 4 days. It could be weird, but I fixed it by changing the project path: I simply placed the project 2 or 3 folder outer than before. It seems that the Swift compiler could not reach that nested folder level.Heth
LOL - I had this problem with Xcode 12.4 and SQP AppCenter. I had to close and open the xcworkspace several times. From the third one the import worked...Congregation
You can try the top answer of this ask. link hereNolanolan
https://mcmap.net/q/16068/-getting-error-quot-no-such-module-quot-using-xcode-but-the-framework-is-thereRachmaninoff
If you are getting this issue only on Simulator and not on real device, this answer might fix this issue https://mcmap.net/q/16068/-getting-error-quot-no-such-module-quot-using-xcode-but-the-framework-is-thereCastilian
Also, if you are trying to build on Apple Silicon MacCastilian
C
412

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.

Chinachinaberry answered 26/6, 2015 at 15:42 Comment(9)
Thanks. I had to do this in my project build settings rather than my target build settingsIncur
The trick for me was finding a path to the framework to use in the Framework Search Paths. ${TARGET_BUILD_DIR}/YourFrameworkName.framework works well for me. See also stackoverflow.com/questions/32816507/…Spittle
@malhal 1. Make 'Embedded Content Contains Swift Code' - Yes Under Build Settings 2. Set the framework search path to $(SRCROOT) [Note: only include path don't include xxx.framework]Anderton
That worked, thanks. I didn't need to change the path, just setting to recursive fixed itExcitor
So I'm including my framework as a sub-project, then I have it built as a dependency, my solution was to use ../../build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to find the correct frameworkParalyse
NOTE ON THE FIX: $(SRCROOT) only worked for me when I added it to the Framework Search Path FOR THE PODS PROJECT.Phytobiology
Try this: comment out the import line, build (lots of errors), uncomment the import line and build. This seems to "kickstart" the compiler into seeing what's in front of it's nose.Jovia
$(SRCROOT) , recursive, also for "Header Search Paths" worked for me!Angwantibo
OMG! The real fix (for me at least) was: 1. Firstly, reset App's FRAMEWORK_SEARCH_PATHS to be just $(inherited) and nothing custom. 2. Secondly, Add to Framework both SUPPORTS_MACCATALYST = YES; and DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; (i.e. click it's project, then Editor menu's Add Build Setting > Add User-Defined Setting option). 3. Lastly, we needed to change LD_DYLIB_INSTALL_NAME (i.e. Dynamic Library Install Name) setting to $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH) value. Note: skip second step if not using CatalystMorphology
M
879

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

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

Miyamoto answered 26/11, 2015 at 20:15 Comment(8)
I tried this as a holy grail. Funny. Who knows but exiting then reopening the workspace actually worked as well. Clean, then build.Obstetric
This happened to me after Xcode crashed and I selected 'reopen' application from the bug report. I will know better next time.Pinprick
Also applies to building on the command line (our problem): xcodebuild -workspace yourproject.workspace.Yerkovich
I often used xed folder, and it looks like this reads the xcodeproj file instead of xcworkspace. When I explicitly used open -a finder folder` and clicked xcodeproj, it worked fine. No xcode 'clean' required.Exospore
For those who are building from cli using xcodebuild, specifying the workspace i.e., -workspace <>, did the trick.Chary
https://mcmap.net/q/16068/-getting-error-quot-no-such-module-quot-using-xcode-but-the-framework-is-thereRachmaninoff
OMG yes! I tried to extract a part of app into a framework, and thought I could get away with adding that project into app project. Nope. Two separate projects (in subfolders), one workspace, open only that one.Tengler
I usually open the /ios directory and it picks the right one but looks like it doesn't with the latest update. Thanks for saving me at least a couple of hours!Durango
C
412

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.

Chinachinaberry answered 26/6, 2015 at 15:42 Comment(9)
Thanks. I had to do this in my project build settings rather than my target build settingsIncur
The trick for me was finding a path to the framework to use in the Framework Search Paths. ${TARGET_BUILD_DIR}/YourFrameworkName.framework works well for me. See also stackoverflow.com/questions/32816507/…Spittle
@malhal 1. Make 'Embedded Content Contains Swift Code' - Yes Under Build Settings 2. Set the framework search path to $(SRCROOT) [Note: only include path don't include xxx.framework]Anderton
That worked, thanks. I didn't need to change the path, just setting to recursive fixed itExcitor
So I'm including my framework as a sub-project, then I have it built as a dependency, my solution was to use ../../build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to find the correct frameworkParalyse
NOTE ON THE FIX: $(SRCROOT) only worked for me when I added it to the Framework Search Path FOR THE PODS PROJECT.Phytobiology
Try this: comment out the import line, build (lots of errors), uncomment the import line and build. This seems to "kickstart" the compiler into seeing what's in front of it's nose.Jovia
$(SRCROOT) , recursive, also for "Header Search Paths" worked for me!Angwantibo
OMG! The real fix (for me at least) was: 1. Firstly, reset App's FRAMEWORK_SEARCH_PATHS to be just $(inherited) and nothing custom. 2. Secondly, Add to Framework both SUPPORTS_MACCATALYST = YES; and DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; (i.e. click it's project, then Editor menu's Add Build Setting > Add User-Defined Setting option). 3. Lastly, we needed to change LD_DYLIB_INSTALL_NAME (i.e. Dynamic Library Install Name) setting to $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH) value. Note: skip second step if not using CatalystMorphology
I
122

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

Interpellate answered 22/9, 2017 at 21:52 Comment(5)
In my case, the subproject had only Debug and Distribution and its parent project was trying to build for Release. Solution was to make a copy of Distribution in the child project and rename that copy Release.Sterigma
This led to me finding the issue, but I solved it by adding to the framework search paths in my custom configurations since I didn't want to touch a 3rd party subproject :)Lasonde
This is the correct answer in case you have a subproject (in my case subproject with a framework), because when .framework is built it is located in a different build folder when configurations do not match that's why Xcode can't find framework (module)Harr
I have project with structure like this(not like in answer - AppUI and AppDomain live without nested to App): -App.xcodeproj -AppUI.xcodeproj -AppDomain.xcodeproj So this answer works for me when I did so and added AppUI.framework, AppDomain.framework to App in section Frameworks, Libraries and Embedded contentMetropolis
Man thank you, one long day of frustration saved!Genital
O
52

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

Ovalle answered 17/10, 2015 at 19:15 Comment(0)
C
47

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
use_frameworks!

...aaand it worked :)

Colostomy answered 22/2, 2016 at 18:33 Comment(1)
Yeah for me use_frameworks wasn't even in my Podfile so I added itTracheostomy
U
37

The following steps worked for me.

  1. Quit xcode
  2. Run "pod update" in terminal
  3. Open .xcworkspace and build again.
Uzziel answered 14/8, 2018 at 4:49 Comment(0)
B
27

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

Enter image description here

Bagehot answered 2/9, 2016 at 5:12 Comment(3)
Also mentioned by Chris Prince.Production
This really helped me thanks. But reminder for other readers: After doing this, delete your Derived folder, and restart Xcode.Galloglass
For me works when I added SnapKit to: 1) Frame Search Paths -> "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" 2) Header Search Path -> "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" 3) Other C Flags -> framework "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit"Metropolis
S
21

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.

Spellbind answered 13/4, 2016 at 15:32 Comment(1)
For some reason this isn't shown in xcode 9.1 even when it's present. Right click on your framework > Show In Finder > and make sure your modulemap is there. If you're using a manual framework in a pods project, rebuild your pods if you've just added a new manual framework or updated an existing one.Mattins
G
21

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.

Gisele answered 30/6, 2016 at 14:1 Comment(1)
Our framework didn't have the AdHoc configuration we used for the project - which meant it didn't build together with the project.Adulterant
B
21

Xcode compile error: No such module

//Swift
import <module_name> //No such module '< module_name >'

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

  • .xcodeproj was opened instead of .xcworkspace
  • module.modulemap or .swiftmodule[About]

Objective-C Library/Framework Target

make sure that generated binary contains module.modulemap file and it's headers 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(consumer). 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(consumer) should point to .swiftmodule

Find Implicit Dependencies

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

CocoaPods

  • Check if this dependency is existed in a target
pod deintegrate
pod install

CocoaPods UI Test Bundle

for App Target where used additional dependency from CocoaPods. To solve it use inherit![About] in Podfile

[Recursive path]

Bergstrom answered 6/12, 2019 at 16:18 Comment(3)
1. Open ProjectName.xcodeworkspace 2. Product -> BuildIdiocrasy
What solved it for me was opening with .xcworkspace instead of .xcodeprojAmbient
In my case, I had to add a module to the Link Binary With Libraries.Regal
W
17

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.

Wuhu answered 7/4, 2015 at 20:19 Comment(3)
I just did it as you told me, and it doesn't work :/Coupe
Then you may be facing a different problem that just looked the same as the one I encountered. :-/Wuhu
I was having the same issue with a Cocoapod and deleting the files in ModuleCache did the trick for me.Astrograph
Q
17

For me Build Active Architecture Only was set to Yes for the selected configuration. This did the trick:

Select "Pods" from the left project navigator > Select "Build Settings" > Build Active Architecture Only to No

Quiberon answered 14/5, 2019 at 10:3 Comment(1)
It's the trick for old projects on m1. Because old Pods uses old architecture, they may not support the m1 on their old versions.Chacha
B
15

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

Belemnite answered 19/12, 2016 at 12:15 Comment(1)
You saved my plenty of hours. Actually to speed up my code 12, I unchecked Find implicit Dependencies as per some solutions over stackoverflow. But after reopening the project its starting to complain.Instrumentalism
G
15

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.
Grandioso answered 26/11, 2019 at 10:17 Comment(1)
In my case besideds #3 I also had to check that Excluded Architectures matched both modules (TriviaApp and Social in this example). Hope it helps!Lipography
W
12

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.

Winker answered 14/2, 2019 at 14:32 Comment(0)
R
10

As for xCode 12 and simulators,

the error might disappear when you navigate to Pods.xcodeproj in project navigator, and in build settings under the 'Excluded Architectures', for every Debug and Release, chose 'Any iOS Simulator SDK' with value arm64.

Ritchie answered 14/12, 2020 at 14:6 Comment(2)
For me, removing the following from my podFile fixed it: installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" endOomph
I tried all the solutions above but only this one worked for me. Thanks.Plumbery
R
8

Resolve issue of Webview of apple iOS xcode Version 12.3 (12C33)

METHOD 1:Simply Do 3 steps:

  1. Open project with .xcodeproj

  2. Quit Xcode

  3. Reopen project from .xcworkspace

Done

METHOD 2: Simply Do 3 steps:

  1. Open podfile -> Add use_frameworks! in podfile -> save pod file

  2. Quit Xcode

  3. run pod install

  4. Reopen project from .xcworkspace

All Done

Rachmaninoff answered 11/11, 2021 at 11:4 Comment(2)
does not fix itMohun
This worked for me! But the problem came back again as soon as I did "clean build folder"Striking
D
7

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.

Demolish answered 18/3, 2016 at 3:31 Comment(0)
N
7

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

Nagaland answered 21/11, 2019 at 12:20 Comment(0)
E
6

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.

Evansville answered 24/7, 2015 at 6:58 Comment(1)
It worked only once, then when i run goes to the same issue of not finding the module.Paddle
T
6

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
  use_frameworks!

  # Pods for MyApp

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

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

end

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

Thenna answered 20/2, 2017 at 4:14 Comment(0)
N
5

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.

Nordau answered 25/11, 2016 at 22:53 Comment(0)
C
5

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.

Chopstick answered 2/4, 2017 at 22:30 Comment(0)
R
5

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.

Restriction answered 16/8, 2017 at 15:2 Comment(0)
P
5

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.

Py answered 8/1, 2018 at 13:7 Comment(0)
J
5

I was having a similar issue with xcode 10.3. xCode was unable to recognise files from pods. Here I have solved this way:

  • Go to Build Phase
  • Link Binary with Libraries
  • Add framework from pods (in my case EPSignature.framwork)
  • Clean & build the project

Error is gone. enter image description here

Jetta answered 7/9, 2019 at 17:20 Comment(0)
C
5

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
  shared_pods
end

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

target 'Release' do
  shared_pods
end

target 'Development' do
    shared_pods
end

Hopefully this saves someone a few days of frustration.

Collectivism answered 30/5, 2020 at 22:20 Comment(1)
shared_pods depreacatedPrebend
W
4

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.

Whichever answered 16/12, 2015 at 21:24 Comment(0)
N
3

I just removed the frameworks by removing references and again added them.

Nebraska answered 7/4, 2016 at 6:11 Comment(0)
F
3

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.

Fluecure answered 13/10, 2017 at 5:9 Comment(0)
L
3

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

Leslileslie answered 11/5, 2018 at 13:15 Comment(0)
H
3

If you have more than one project in workspace, you need to:

  1. add new configuration to all of the projects

  2. product -> clean

  3. delete derived data

  4. pod install in terminal

  5. build your project.

Hyperplane answered 19/10, 2018 at 10:23 Comment(0)
F
3

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

Fascinator answered 14/12, 2018 at 9:11 Comment(0)
E
3

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

Extracanonical answered 27/12, 2018 at 8:10 Comment(0)
B
3

Surprised this even worked. My solution was to go to ...

Build Settings -> Framework Search Paths -> highlight debug -> press delete -> it should automatically fill out a path. -> Do the same for release

Result: enter image description here

Barter answered 22/5, 2020 at 5:48 Comment(0)
S
3

The only thing that worked for me using M1 machine was to run Xcode using Rosetta.
Without that, I was able to run the app only on real device, but not on the iOS simulator.
Building the app can be a little slower but it resolves the issue definitely.
If you dont know how to turn the Rosetta on, here are the steps:

  • Quit Xcode
  • Find Xcode in Applications folder, right click on it and press Get Info
  • Tick the Open using Rosetta as it is shown on the image below
  • Open Xcode again and run your app

Not sure if deleting derived data and cleaning the project is necessary, but you can also do it.

1

Stuffy answered 27/10, 2022 at 6:20 Comment(0)
L
2

This is what finally worked for me. Its pretty lame that I had to do all this, but this was the only thing I could find that worked.

After ensuring the library was listed under linked framework and libraries. If its not there you can click the + and hopefully see your framework/pod listed.

enter image description here

Click on your project in the scheme icon (see image below)

enter image description here

Then you should see your framework of focus listed:

enter image description here

Click Manage Schemes.

Then you should see something like this:

enter image description here

Tick the box for your framework, click AutoCreate Schemes now, then close.

Then try to import your framework/pod again.

It worked for me.

Leandra answered 8/5, 2018 at 22:54 Comment(0)
P
2

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

$(PROJECT_DIR)/Carthage/Build/iOS

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.

Psychognosis answered 5/9, 2018 at 18:0 Comment(0)
S
2

For me going to Edit Scheme -> Run, and changing the debug configuration to Debug from Release fix the problem.

Siddon answered 2/9, 2019 at 15:8 Comment(0)
O
2

Most of the other answers are for CocoaPods or Carthage users. If you are NOT using either of these, but just want to drop a framework in your project and link against it, it will need to be in a framework search path.

The system frameworks are already in the search path (namely /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${version}.sdk/System/Library/Frameworks/). If the ones you are trying to use are not in this path, you need to add their path to FRAMEWORK_SEARCH_PATHS in your Build Settings.


Why doesn't XCode knows where to find it without this even though the framework on your left panel has a location and full path listed in the Identity and Type in the right panel? That... I don't know.

Overawe answered 14/11, 2019 at 15:50 Comment(0)
C
2

In rare cases this error might be fixed by setting proper platform here [ProjectNavigator]->[Project]->[Target]-> (Architectures) BaseSDK

enter image description here

When creating a framework I've chosen accidentally wrong template (as I was creating macOS framework previously) because it was set to like my previous choice. When adding a target it is easy to miss out configuring platform so double check that.

enter image description here

Cree answered 26/11, 2019 at 11:43 Comment(0)
L
2
  1. Check whether you are using latest version of xcode.(If not update to the latest version supported by your device).
  2. Install cocoapods with sudo gem install cocoapods
  3. Run pod setup

I can confirm that the above steps solved my error :-)

Largehearted answered 10/1, 2020 at 8:30 Comment(0)
E
2

In the Target's build settings Set the "Framework Search Paths" to $(inherited) and recursive. [1]

Exanimate answered 15/1, 2020 at 12:3 Comment(0)
B
2

For me the answer was to go to the Targets, first check do the target name and the project name match, if they do, then go to General -> Frameworks and add them manually. When I did that, I clean build the app, and everything was working fine. Unfortunately, none of the answers before resolved my issue, so maybe this can help you as well.

enter image description here

Butyraceous answered 24/7, 2021 at 19:46 Comment(0)
M
1

For what it's worth (I'm new to this using Xcode 7.2/Swift 2), but I noticed that just having the .swift file from the library in the project directory automatically gives you access to it and does not need the using statement.

Example: I'm using SwiftyJSON and just having the SwiftyJSON.swift file in the project was all I needed. The using statement was actually giving me the 'no such module' error and taking it out resolved it, and it works fine.

Magnesia answered 13/1, 2016 at 0:25 Comment(0)
H
1

I had similar problem with loading FacebookSDK, I added ~/Documents/FacebookSDK (search where your frameworks are) to Framework search paths in Build settings and after that I was able to import the FBSDKShareKit module

Hardness answered 5/5, 2016 at 10:51 Comment(0)
P
1

IF you have done everything above and still nothing worked for you then try adding $(inherited) in Framework search path of your target's build setting.

Pantsuit answered 31/12, 2016 at 13:57 Comment(0)
D
1

The solution for me was. Inside of the targets -> Build Settings -> Framework Search Paths and adding $(inherited). However if it is a cocoapods your answer probably inside of output in terminal.

Daggna answered 10/2, 2017 at 5:9 Comment(0)
P
1

Just for completing with another possibility, this error might happen when the option "Find Implicit Dependencies" is unchecked. Go to Edit Scheme -> Build.

enter image description here

Then check this options.

enter image description here

Pantia answered 6/3, 2017 at 11:21 Comment(0)
C
1

Sometimes you have to install the Pods.

  1. Open terminal
  2. cd project
  3. pod install
  4. Open .xcworkspace and
  5. Build is succesful
Centimeter answered 13/5, 2017 at 15:59 Comment(0)
C
1

I had this problem while developing a custom Pod. Found that I just needed to specify the dependency in my Procfile:

Pod::Spec.new do |s|
   # ... other declarations

   s.dependency 'Alamofire', '~> 4.3'
end
Christianson answered 25/7, 2017 at 15:57 Comment(0)
R
1

I was getting this issue because I set the wrong target in the podfile (the project itself rather than the UITests section).

Runofthemill answered 4/10, 2017 at 14:38 Comment(0)
C
1

In my case, the problem was simply that some of the projects that used the framework had a deployment target iOS version previous to the deployment target iOS version of the framework. Once I changed the framework deployment target iOS version, the error went away. enter image description here

Carmencarmena answered 6/6, 2018 at 14:13 Comment(0)
G
1

My problem (this time) was that I used an outdated version of the library in my Podfile.

I used:

pod 'LBTAComponents', '~> 0.1.9'

which didn't work, but when I changed it to:

pod 'LBTAComponents', '~> 1.0.2'

it worked.

Glyph answered 24/8, 2018 at 8:8 Comment(0)
S
1

In my case, I try every suggestion above still not working. I just copy the file's content which show the error without the import stuff and paste it to another file with same imports and comment the error file out. Run the project again it worked, then I delete the original error file and create a file with same name and make it's content back again with the same imports. I think in my case I just figure a way to let it be able to link those imports once and it should be fine.

Straub answered 7/1, 2019 at 19:18 Comment(0)
M
1

This can also happen when the framework does not compile properly.

Open the framework project in Xcode and see if Product → Build succeeds.

Once you have fixed the build errors in the framework, open the main project and see if you can import the framework.

Maverick answered 24/2, 2022 at 18:31 Comment(0)
B
1

I find the solution for my case some minutes ago. The project was an objective c project with cocos2d framework. None of the previews solution works.

Just I delete the VALID_ARCH row at User-Defined at Build Settings and the project start to build on simulator.

Beforehand answered 9/8, 2022 at 8:36 Comment(0)
M
1

For those who have multiple targets, check if framework was added on the right target. (in Frameworks, Libraries, and Embedded Content).

Megara answered 23/12, 2022 at 21:12 Comment(0)
F
1

For me what resolved the problem was selecting the pods module (from the left of where you choose a target device) and run build on it. Once the building was done, I switched back to my own module, build it and there was no error anymore.

Fortin answered 7/6, 2023 at 18:52 Comment(0)
C
0

For me this occurred on RxSwift and the issue was I had fixed it to 3.0.0 in the Podfile. Removing the version restriction and update the pods upgraded it to 3.1.0 which fixed it.

Comparator answered 14/1, 2017 at 4:42 Comment(0)
S
0

This error can also be caused by the framework lacking a module map. If the framework you are trying to import is yours, check for compiler warnings on the framework itself. In my case my framework was building and in place, but there was a build warning:

warning: no umbrella header found for target 'MyFramework', module map will not be generated

By resolving this warning (which related to the framework header not matching the module name), I was able to import the framework.

Suomi answered 14/4, 2017 at 14:21 Comment(0)
D
0

In my case, I just had to reload the project. I had used command-line to clone my project, but it didn't install the submodule correctly. To remedy, I cloned the project through XCode, and everything works. Just make sure you back up any changes first.

Dumpy answered 23/6, 2017 at 17:40 Comment(0)
S
0
  1. In your podfile, remove the pod that creates a problem, and save the file
  2. Run pod install
  3. Re-add the pod, save the file
  4. Re-run pod install
Shandeigh answered 23/8, 2017 at 18:33 Comment(0)
B
0

In my case with project on swift 4 libraries weren't compiled so it wasn't possible to find them and import. The solution was to set compile version for libraries of cocoapods as swift 3.2 enter image description here

Burack answered 31/10, 2017 at 7:59 Comment(0)
O
0

I installed the pod Fakery, the pod got added under my Pods file, however when I tried to use it I got the same error. Problem was, I didn't build it, after building it , the swift compiler threw a few errors in the Fakery swift files that some functions have been renamed, it also provided fixes for them too. After resolving all those compiler issues , build succeeded and I was able to use the module. So swift language compatibility was the problem in my case.

Oink answered 13/12, 2017 at 5:58 Comment(0)
M
0

I win the award for dumbest cause of the "No such module" error. In my case I build the included framework by hand, and copy it into my project directory. My framework search paths were set correctly, and the framework was added to the project correctly.

When I archived the framework I was building, I used "Show in Finder" to take me to the release folder in derived data. But I didn't noticed that the folder contains only an alias to the framework, not the framework itself. The original framework remained in my derived data directory, so later when I cleared derived data the framework was deleted, but my project didn't know that.

Re-archiving the framework, following the alias to the actual framework, and copying that to my project directory worked.

Melancholy answered 18/9, 2018 at 15:38 Comment(0)
K
0

If it's just simple project, without cocoapods, like I had, u can try to move your framework inside your project directory and re-link. I had it on a desktop, but linked and "import MyFramework" made an error. After moving it inside project directory and linking it again, it worked.

Kazue answered 7/10, 2018 at 21:57 Comment(0)
W
0

I actually solved this much more easily by adding to the end of build-debug.xconfig

#include "../Pods/Target Support Files/Pods-IAP/Pods-IAP.debug.xcconfig"

And to the end of build-release.xconfig

#include "../Pods/Target Support Files/Pods-IAP/Pods-IAP.release.xcconfig"

since those files already define PODS_ROOT and the related build variables.

Wadesworth answered 13/11, 2018 at 20:36 Comment(0)
Z
0

Another possible cause in XCode 10 can be the Supported Platforms sometimes gets changed to macOS and the Valid Architectures gets changed to i386 x86_64 for the Pods Projects. Assuming the project is for iOS, then select the Pods Project and change the Supported Platforms to iOS and the Valid Architectures to arm64 arm64e armv7 armv7s, You could do each of the Targets, however that takes longer if you have more than one Pod. Also the Swift version of frameworks in written Swift sometimes gets set to the wrong version.

Zitella answered 4/1, 2019 at 14:9 Comment(0)
Y
0

One more suggestion for Xcode 10+ and projects that 1. created with Xcode version <10, 2. Contain a subproject with a framework that the main project depends on. The issue is that Xcode will place the compiled framework in the directory specified in the subproject, which is likely different from the main project build directory.

Check File > Project Settings. Now, click "Advanced..." and select something other than "Legacy" as the build path, for example, "Unique". In that case Xcode will put all builded components into one folder and it should be able to find the "missing" module.

Yuyuan answered 24/1, 2019 at 1:57 Comment(0)
C
0

For me, I fixed it be replacing any tilde (~) characters in my Custom Paths with $(HOME). Custom Paths are located in the Xcode preferences under the Locations tab.

Cockayne answered 14/3, 2019 at 13:30 Comment(0)
R
0

I am still not able to make archive from xcode but fastlane did the work for me

Roup answered 10/11, 2020 at 10:6 Comment(0)
J
0

After trying all the ideas on this thread, it worked when I updated cocoapods.

$ pod --version
$ 1.0.0 // should have been 1.10.0

You should update cocoapods

gem which cocoapods
Janaye answered 18/11, 2020 at 17:17 Comment(0)
P
0

Go to the folder where the project is and delete the plugin causing the error there. For me, I deleted the Google Mobile Ads Sdk folder that caused the error and the problem was fixed. It was enough to include it with pods.

Psf answered 27/2, 2021 at 16:27 Comment(0)
C
0

Sazzad Hissain Khan's 3. option adding the same "Build Configurations" in the App's framework than in the App solved my "Unknow module" issue.

enter image description here

This post helped me to understand how to add new build configurations, since going to Editor -> Add configuration was greyed out

Adding a build configuration in Xcode

Crucify answered 16/6, 2021 at 11:32 Comment(0)
C
0

For me the issue was because the project file was missing this file "coursesX.xcworkspace"

When I added it and re-opened the project everything worked well

Cailean answered 15/10, 2021 at 20:53 Comment(0)
R
0

In my case: The issue only occurs on Xcode 12.4, but not Xcode 13. one of the framework of test target gives this error after I rebuild that framework for arm64 simulator support (in XCFramework format). I fixed it by update the path in Framework Search Paths

"$(SRCROOT)/Carthage/Build/WireTesting.xcframework/ios-x86_64-simulator" 

to

"$(SRCROOT)/Carthage/Build/WireTesting.xcframework/ios-arm64_x86_64-simulator" 
Retro answered 24/1, 2022 at 11:34 Comment(0)
S
0

If you use CocoaPods, try to comment out (#) the new pod, run pod install, bring it back and pod install again. Sometimes somewhy pod script does not produce correct dependencies (or is in conflict with running xCode?) so it -sometimes- does help

Sinistral answered 21/7, 2022 at 7:13 Comment(0)
U
0

You added the dependency (module) to your pod, but without a version (either specific or range). Please define the version, run pod install, and open the .xcworkspace file not .xcodeproj file

Unknowing answered 18/10, 2022 at 15:54 Comment(0)
C
0

In my case I had 2 xcode installed v14 and v15. I was trying to open a project in xcode 14 which was using SwiftData which was supported only in Xcode 15. Make sure that you are not opening a project which uses apis' supported only in the latest versions of the xcode.

Call answered 4/9, 2023 at 8:56 Comment(0)
D
0

If you are using cocopods try to find any wronging when you are updating or installing your pods via terminal. Warning messages that appeared on the terminal suggested to add

$(inherited)

to both FRAMEWORK_SEARCH_PATHS and HEADER_SEARCH_PATHS for both Debug and Release. Everything work fine after that.enter image description here

Dipterocarpaceous answered 8/10, 2023 at 9:30 Comment(0)
C
0

If your issue comes when running project on Simulator and on Apple Silicon Mac AND issues goes away when you run on real device.

This might be simulator architecture issue.

  1. You need to support both type of destinations Here is image for that
  1. After setting this option you might still get an error that says "You need to install rosetta". please run this command on terminal softwareupdate --install-rosetta and run again.
Castilian answered 22/12, 2023 at 6:19 Comment(0)
H
0

I had this kind of error on my react native project and I deleted Podfile.lock file and pod install again and its works.

Harelda answered 3/2 at 9:2 Comment(0)
B
0

== SwiftUI and Using SPM(Swift Package Manager) ==

I had already added using SPM but still I faced this issue. I had the same issue, not sure if it will help you but try Project -> TARGETS("Project name") Frameworks, Libraries, and Embedded Content. Check if there is "Supabase" under Name if not try to add it by clicking the plus icon.

supabase image

Basanite answered 28/2 at 14:6 Comment(0)
G
0

I got the same error for Flutter and for Firebase I tried all the answers and none of them worked for me. After many trials, my problem was that the development certificate of the Apple developer account was expired, I believe it is Xcode new version (15) problem because when I have an old mac not updated. when I opened the project on the old xcode (14) it gave me the error straight away.

In my case the solution was simple, go to the Apple developer certificates page

Make sure that all certificates are not expired, and if you find any expired certificate, click on it and select revoke.

When you open the project if you already enabled automatic syncing it will create a new cerificate for you.

I hope this helps someone, I spent days searching for the solution.

Glaab answered 23/3 at 2:4 Comment(0)
L
-1

Make sure your project folder is not in iCloud Drive.

enter image description here

enter image description here

Lacreshalacrimal answered 13/2, 2021 at 1:25 Comment(0)
F
-3

I went through the above solutions but unfortunately, nothing helped me. What I did later

  1. close the project.
  2. From the terminal, go the project directory and run below command:
  3. git reset --hard origin/master (i wanted to change in master branch.)
  4. git fetch
  5. git checkout master
  6. git pull origin master
  7. Open the project(of course from Xcode)
  8. Clean build and remove derived data.
  9. Build the project again.

yes, I know some commands are redundant. But spending 2 days and pulling my hair out is much worse than those steps.

Finicky answered 20/4, 2020 at 12:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.