额外的争论'错误'在电话中

时间:2016-05-10 04:36:05

标签: swift swift2

我在这段代码上有这个错误,任何人都可以告诉我如何在Swift 2.0中更改它

if jsonResponse != nil {
  propertyListResponse = NSJSONSerialization.JSONObjectWithData(jsonResponse, 
    options: NSJSONReadingOptions.MutableLeaves,
    error: nil)

1 个答案:

答案 0 :(得分:0)

删除参数列表中的错误

if jsonResponse != nil { propertyListResponse = try NSJSONSerialization.JSONObjectWithData( jsonResponse, options: NSJSONReadingOptions.MutableLeaves ) 
...
catch let error as NSError {
    // error handling
    print(error)
  }
}