SwiftyJSON is a great third-party library for the Swift language, mainly dealing with JSON data, written by ThoughtWorks’ engineering master Ruo Yu.
When using SwiftyJSON, Xcode reports an error: No such module ‘SwiftyJSON’
SwiftyJSON Github:
Manually (iOS 7+, OS X 10.9+):
To use this library in your project manually you may:
for Projects, just drag SwiftyJSON.swift to the project tree
for Workspaces, include the whole SwiftyJSON.xcodeprojInitialization
import SwiftyJSON
let json = JSON(data: dataFromNetworking)
let json = JSON(jsonObject)
Problem recurrence:
Xcode: Version 7.1.1 (7B1005)
Create a new project and select Single View Application.
Follow the instructions in SwiftyJSON and drag and drop SwiftyJSON.swift directly into the project using the manual method.
Then use import in UIViewController to introduce SwiftyJSON.
import UIKit
import SwiftyJSON //Xcode ERROR: No such module 'SwiftyJSON'
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Xcode: no such module ‘swiftyjson’
Solution:
After a search on the Internet, many people have encountered this problem. On stackoverflow, I found that someone answered:
If you added SwiftyJSON.swift to your project, you don’t need to import it.
It’s already available.
Originally, the swiftyjson.swift file was added to the project, so you don’t need to import it again, you can use it directly( (dizzy)
You can directly use the JSON () method in your code:
let JSON = JSON (data: datafromnetworking)
let JSON = JSON (JSON object)
References:
http://stackoverflow.com/questions/26754481/example-handling-json-with-swiftyjson
https://github.com/SwiftyJSON/SwiftyJSON
https://github.com/lingoer/SwiftyJSON
Similar Posts:
- [Solved]Swift error: Method does not override any method from its superclass
- Xcode Command PhaseScriptExecution failed with a nonzero exit code
- package wang/test is not in GOROOT (/usr/local/go/src/wang/test)
- Gin does not contain package github.com/gin-gonic/gin/json
- JAVA: How to Solve @override error
- How to Solve JAVA @override error
- [Swift] an error occurs when passing parameters using alamofire
- [Two Solutions] Syntax error: unexpected token import
- @Override must override a superclass method problem solving
- How to Solve Error: Unexpected token o in JSON at position 1