swift2 - Generic Parameter 'Key' could not be inferred Swift 2 -


i beginner in swift 2 , not find problem. error in line:

let jsondictionary try nsjsonserialization.jsonobjectwithdata = (data!, options: nsjsonreadingoptions.mutablecontainers) as! dictionary 
func searchitunesfor(searchterm: string) {     let itunessearchterm = searchterm.stringbyreplacingoccurrencesofstring(" ", withstring: "+", options: nsstringcompareoptions.caseinsensitivesearch, range: nil)     let escapedsearchterm = itunessearchterm.stringbyaddingpercentescapesusingencoding(nsutf8stringencoding)     let urlpath: string = "https://itunes.apple.com/search?term=\(escapedsearchterm)&media=software"     let url: nsurl = nsurl(string: urlpath)!     let session = nsurlsession.sharedsession()     session.datataskwithurl(url, completionhandler: {(data: nsdata?, response: nsurlresponse?, error: nserror?) -> void in         {             if let ipstring = nsstring(data:data!, encoding:nsutf8stringencoding){                 let jsondictionary = try nsjsonserialization.jsonobjectwithdata(data!, options: nsjsonreadingoptions.mutablecontainers) as! dictionary                  let results: nsarray = jsondictionary["results"] nsarray                 dispatch_async(dispatch_get_main_queue(), {                     self.tabledata = results                     self.appstableview?.reloaddata()                 })             }         }catch{             print("bad ")         }     }).resume() 

let jsondictionary = try nsjsonserialization.jsonobjectwithdata(data!, options: nsjsonreadingoptions.mutablecontainers) as? nsdictionary 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -