569

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

18
  • 34
    Not to be too mr. obvious but have you tried a full clean and build?
    – Kalel Wade
    Commented Apr 7, 2015 at 20:01
  • 32
    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.
    – Martin R
    Commented Apr 7, 2015 at 20:02
  • 3
    Also you might have to use quotations marks for the import: #import "Social/Social.h"
    – Martin R
    Commented Apr 7, 2015 at 20:04
  • 4
    I changed Deployment Target from 11 to 10, but forget it in Podfile platform :ios, '10.0'. That was solution. Commented Oct 15, 2018 at 15:27
  • 1
    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!
    – Fattie
    Commented Jul 26, 2019 at 10:48

91 Answers 91

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.

1

== 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

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.

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.

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.

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

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.

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.

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.

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.

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.

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.

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.

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
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.

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

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

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
0
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" 
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

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

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.

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

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.
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.

0

In my case I have two pods:

pod 'ModuleA', :path => '../ModuleA'
pod 'ModuleB', :path => '../ModuleB'

"No such module ModuleB" error occur in ModuleA swift source file code at import ModuleB

How to fix? Just add following line in your .podspec file ModuleA.podspec :

s.dependency 'ModuleB'

Then re-run pod install and clean ⌘ + Shift + K and ⌘ + B re-build and success.

0

What worked for me: At the top of XCode, where the scheme is displayed (as 'my scheme'> iPhone15 Pro), click on the dropdown of the scheme, select the framework scheme, and build. Then switch back to the app scheme, and build again.

0

None of the posted solutions worked for me. The trick that worked for me was to Go to -> Your Scheme(Exact left option to the simulator) -> Edit Scheme -> Build -> Override Architectures -> Select "Use Target Settings".

enter image description here

-1

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

-1

Make sure your project folder is not in iCloud Drive.

enter image description here

enter image description here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.