'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'
use_frameworks!
target 'CPod' do
pod 'AFNetworking', '~> 2.5'
pod 'ORStackView', '~> 2.0'
pod 'SwiftyJSON', '~> 2.1'
end
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
Solution 1:
Try adding the Pods
framework to your build scheme and building the framework. After you've built it, build/run your project.
Steps:
-
Scheme menu > Manage Schemes > check
Pods
> Close - Select
Pods
from the scheme menu. - Build
Pods
. - Select your project from the same menu, then build/run it.
Solution 2:
You must reopen project .xcworkspace file(not .xcodeproj) after install your podfile.
- Clone the repo with CocoaPods
- Open YourWorkspace/YourApplication.xcworkspace
- Select the app u want to run Add SwiftyJSON.framework in embedded binaries for that project Hit Run
Happy Coding :)
Solution 3:
You may also try re-installing pods using:
pod deintegrate
and then
pod install
This fixed this issue for me
Solution 4:
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.