在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
var url = NSURL(string: "http://www.weather.com.cn/data/sk/101120501.html") var data = NSData(contentsOfURL: url!, options: NSDataReadingOptions.DataReadingUncached, error: nil) var json : AnyObject! = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions(), error: nil) var weatherinfo: AnyObject? = json.objectForKey("weatherinfo") var city: AnyObject? = weatherinfo?.objectForKey("city")
// println(city)
swiftyJSON
//// // var url = NSURL(string: API_HOST+"/"+LOGIN_API) ////// var url = NSURL(string: "http://www.weather.com.cn/data/sk/101120501.html") ////// let data = NSData(contentsOfURL: url!, options: NSDataReadingOptions.DataReadingUncached, error: nil)
////// ////// // println(city) ////// let jsonS = JSON(data: data!) ////// println(jsonS) ////// println(jsonS[0]["weatherinfo"].string) ////// if let info = jsonS["weatherinfo"].string{ ////// println(info) ////// }
|
请发表评论