yesterday i updated to El Capitan beta 2 and Xcode 7 - beta is mandatory. So i updated my app to Swift 2 and new error comes to the json string. This is my code :
let jsonData:NSDictionary = NSJSONSerialization.JSONObjectWithData(urlData!,options:NSJSONReadingOptions.MutableContainers ) as! NSDictionary
第一种用法:
do {
let jsonData = try NSJSONSerialization.JSONObjectWithData(urlData!,options:NSJSONReadingOptions.MutableContainers ) as! NSDictionary
// use jsonData
} catch {
// report error
} 第二种用法:
letjsonData = try NSJSONSerialization.JSONObjectWithData(urlData!,options:NSJSONReadingOptions.MutableContainers ) as! NSDictionary