Swfit 2“额外的参数”错误“在调用”

我一直有一个问题,了解Xcode希望从我这里得到的“额外论证”错误“调用中”它一直指向

if let feed = NSJSONSerialization.JSONObjectWithData(data, options: .MutableContainers, error: nil) as? NSDictionary, 

我在swift 2的某个地方读过,我应该补充一下。但是每次添加它,我都会继续打破更多的东西。 swift 2中正确的语法是什么?

这是代码:

 override func viewDidLoad() { super.viewDidLoad() let request = NSURLRequest(URL: NSURL(string: feedURL)!) NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { response, data, error in if let feed = NSJSONSerialization.JSONObjectWithData(data, options: .MutableContainers, error: nil) as? NSDictionary, title = feed.valueForKeyPath("feed.entry.im:name.label") as? String, artist = feed.valueForKeyPath("feed.entry.im:artist.label") as? String, imageURLs = feed.valueForKeyPath("feed.entry.im:image") as? [NSDictionary] { if let imageURL = imageURLs.last, imageURLString = imageURL.valueForKeyPath("label") as? String { self.loadImageFromURL(NSURL(string:imageURLString)!) } self.titleLabel.text = title self.titleLabel.hidden = false self.artistLabel.text = artist self.artistLabel.hidden = false } } } 

这是swift 2中error handling的新方法…

 do { if let feed = try NSJSONSerialization.JSONObjectWithData(data, options: .MutableContainers) as? NSDictionary { // Success block... } } catch { print(error) } 

Swift 2这样做的方法是

 let feed = try NSJSONSerialization.JSONObjectWithData(data!, options: .MutableContainers)