'No such module' when I use CocoaPods

So here's my procedure. I create a new Podfile in the project directory, then I added the following

platform :ios, '9.0'

target 'CPod' do
pod 'AFNetworking', '~> 2.5'
pod 'ORStackView', '~> 2.0'
pod 'SwiftyJSON', '~> 2.1'

I fire off pod install, and everything goes well, open up the xcworkspace. I then go over to ViewController.swift and if I try to import a pod I get No such module 'SwiftyJSON', if I were to do import SwiftyJSON. Any ideas?

EDIT: SwiftyJSON is a Swift based module, not Obj-C

Try adding the Pods framework to your build scheme and building the framework. After you've built it, build/run your project.


  1. Scheme menu > Manage Schemes > check Pods > Close

  2. Select Pods from the scheme menu.
  3. Build Pods.
  4. Select your project from the same menu, then build/run it.

You must reopen project .xcworkspace file(not .xcodeproj) after install your podfile.

  1. Clone the repo with CocoaPods
  2. Open YourWorkspace/YourApplication.xcworkspace
  3. Select the app u want to run Add SwiftyJSON.framework in embedded binaries for that project Hit Run

Happy Coding :)

You may also try re-installing pods using:

pod deintegrate

and then

pod install

This fixed this issue for me

Press Command+Option+Shift+K and then Run your app, you will see a magic.

Or from the menu -> Product, press Option on your keyboard and you'll see Clean Build Folder.

It's looking funny that how could Xcode do those things with us but same thing happened to me when I used a Swift library using Pod and after too much struggle I ended up with Clean Build Folder.

Not sure if this would still be helpful for others. But, in my case, it ended up being a silly mistake of not referencing dependencies from the .podspec file.

We have an application with multiple internal libraries, and those libraries also have dependencies on each other - which we accounted for the in the Podfiles... but NOT in the podspecs.

So, even though our Podfiles had:

Application / Podfile

# Development Pods
pod 'ConsumingLibrary ', :path => '../ios-consuming-lib'
pod 'DependentLibrary1', :path => '../ios-library-one'
pod 'CommonCoreLibrary', :path => '../ios-common-core-lib'

ConsumingLibrary / Podfile

# Development Pods
pod 'DependentLibrary1', :path => '../ios-library-one'
pod 'CommonCoreLibrary', :path => '../ios-common-core-lib'

Needed to also call it out in the .podspec's:

ConsumingLibrary / ConsumingLibrary.podspec

  # TODO
  # Add here any resources to be exported.

  s.dependency 'DependentLibrary1', '~> 0.1.0-RC'

DependentLibrary1 / DependentLibrary1.podspec

  # TODO
  # Add here any resources to be exported.

  s.dependency 'CommonCoreLibrary', '~> 0.1.0-RC'

I think I wasted about 2 hours trying to figure out why I could build ConsumingLibrary & run tests, but as soon as I built the app, that consumed all three libraries - I kept getting:

No such module 'DependentLibrary1'

  • possible duplicate of Swift: Cannot use library from Pod file
  • That would be the case for AFNetworking , but that's a different story. SwiftyJSON is a Swift library, therefore that post doesn't answer the question. @Rugmangathan
  • which version of cocoapods are you using?
  • I believe it it 0.37.2 @MichaelDautermann
  • @Idris had the exact same issue. May be an Xcode 6.3.2+ problem.
  • You rocked it! Thank you for this :)
  • In Xcode 11.0 it is now under Product -> Scheme -> Manage Schemes
  • didn't work with me in XCode 11.2.1
  • THANK YOU!! this was exactly what I needed. I had no idea about workspaces and had always been opening the xcodeproj file.
  • sometimes it's necessary to run these commands twice... Additionally I've run rm -rf ~/Library/Developer/Xcode/DerivedData/* command
  • I did this and then build the pod scheme and the library scheme then it work.
  • Of all the hundreds of solutions out there for the 'No such module' error after installing pods in an Xcode project, this is the only one that actually works for me. +1.
  • use_frameworks! you don't need to import the Obj-C header, you import the module, also the OP is using swift where do you see the need to import into Obj-C?