Jacobo Koenig
Jacobo Koenig

Reputation: 12534

No such Module 'SwiftyJSON' on Swift 3.0

After migrating to Swift 3.0, I am trying to import SwiftyJSON into my project. However, when I import the framework 'import SwiftyJSON' I get a No Such Module error.

If I remove the import statement, it does not recognize its classes.

Any advice as to why XCode might not be reading my imported framework?

See screenshots attached:

enter image description here

enter image description here

enter image description here

Upvotes: 29

Views: 34827

Answers (11)

ronak patel
ronak patel

Reputation: 400

Clean your project and than build and run your project and then not work so remove your swiftyjson cocoa library in your cocoapods and reinstall it should surely work.

Upvotes: 0

user8377151
user8377151

Reputation:

  1. In your Xcode project go to podfile and enter :

     pod 'SwiftyJSON'
    
  2. Save and close the Xcode.

  3. Open terminal and go to project directory and enter :

     pod install
    
  4. Open the project and Import SwiftyJSON in which file you want to use.

Upvotes: 0

Divesh singh
Divesh singh

Reputation: 437

//import SwiftyJSON comment out first then pod install and then agian add import SwiftyJSON and pod install it work for me

Upvotes: 0

Armin
Armin

Reputation: 659

This solution helped me. Build the modules individually, and then build your project.

https://stackoverflow.com/a/37732248/4899943

Upvotes: 0

oOEric
oOEric

Reputation: 1079

remove import SwiftyJSON to solve No such Module 'SwiftyJSON' on Swift 3.0

Swift can load the SwiftyJSON.swift by itself. No need to specify it at import statement.

Ref: https://github.com/SwiftyJSON/SwiftyJSON/issues/49

Upvotes: 5

Derek Soike
Derek Soike

Reputation: 11670

If you have multiple targets, try building each of them. I had two targets - one would build and the other would not. This may help you trace the issue.

In my case I just nuked my dev target that was not working, duplicated the production target, made a few settings changes, and was back in action.

Upvotes: 1

Greg Hilston
Greg Hilston

Reputation: 2424

My problem was I was opening the project file and not the workspace file...

Upvotes: 44

Sour LeangChhean
Sour LeangChhean

Reputation: 7419

Clean your project and build again. Make sure you open project.xcworkspace.

pod 'SwiftyJSON'

Upvotes: 6

Q A
Q A

Reputation: 200

Updating my pod to reference the official SwiftyJSON gem worked for me! It updated from version 2.3.2 (what was installed by default via 'pod SwiftyJSON') to version 3.1.1.

So, in your Podfile, udpate your SwiftyJSON pod to:

 pod 'SwiftyJSON', :git =>'https://github.com/SwiftyJSON/SwiftyJSON.git'

HTH

Upvotes: 10

Durul Dalkanat
Durul Dalkanat

Reputation: 7445

Try this.

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'Project names' do
  pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git', branch: 'swift3'    
end

post_install do |installer|
   installer.pods_project.targets.each do |target|
       target.build_configurations.each do |config|
           config.build_settings['SWIFT_VERSION'] = '3.0'
       end
   end
end

Upvotes: 2

Dmitry
Dmitry

Reputation: 3089

Try to check Targets-> Build Phases Link Binary With Libraries There must be a link with SwiftyJSON Check

Upvotes: 12

Related Questions