Reputation: 12534
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:
Upvotes: 29
Views: 34827
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
Reputation:
In your Xcode project go to podfile and enter :
pod 'SwiftyJSON'
Save and close the Xcode.
Open terminal and go to project directory and enter :
pod install
Open the project and Import SwiftyJSON
in which file you want to use.
Upvotes: 0
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
Reputation: 659
This solution helped me. Build the modules individually, and then build your project.
https://stackoverflow.com/a/37732248/4899943
Upvotes: 0
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
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
Reputation: 2424
My problem was I was opening the project file and not the workspace file...
Upvotes: 44
Reputation: 7419
Clean your project and build again. Make sure you open project.xcworkspace.
pod 'SwiftyJSON'
Upvotes: 6
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
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
Reputation: 3089
Try to check Targets-> Build Phases Link Binary With Libraries
There must be a link with SwiftyJSON
Upvotes: 12