Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'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

like image 271
Idris Avatar asked Jun 26 '15 05:06

Idris


People also ask

Can I use both CocoaPods and SPM?

Cocoapods + SPM 🚀 Now your library supports both cocoa pods and SPM.

How do I use CocoaPods with my internal iOS frameworks?

If you've used CocoaPods before, you probably know that the usual way to get started using it is by running pod init in the directory that contains the . xcproject file. Running this command creates a workspace that CocoaPods can use to manage the dependencies.


2 Answers

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

Steps:

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

    enter image description here

  2. Select Pods from the scheme menu.
  3. Build Pods.
  4. Select your project from the same menu, then build/run it.
like image 74
Micah Benn Avatar answered Sep 25 '22 07:09

Micah Benn


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 :)

like image 31
Asil ARSLAN Avatar answered Sep 23 '22 07:09

Asil ARSLAN