ios - Errors thrown from here are not handled....bug -
could please explain why i'm getting error based on other code located?
why compile fine:
func serializejsondata(jsondata: nsdata) -> nsdictionary { { let searchresultsjson: nsdictionary = try nsjsonserialization.jsonobjectwithdata(jsondata, options: .mutablecontainers) as! nsdictionary return searchresultsjson } catch let error nserror { print("json error: \(error.localizeddescription)") let returndictionary = [:] return returndictionary } } func parseforms(formsarray: nsarray) -> nsarray { var retval = [searchformobject]() form in formsarray as! nsdictionary { } return retval }
when when switch methods around this:
func parseforms(formsarray: nsarray) -> nsarray { var retval = [searchformobject]() form in formsarray as! nsdictionary { } return retval } func serializejsondata(jsondata: nsdata) -> nsdictionary { { let searchresultsjson: nsdictionary = try nsjsonserialization.jsonobjectwithdata(jsondata, options: .mutablecontainers) as! nsdictionary return searchresultsjson } catch let error nserror { print("json error: \(error.localizeddescription)") let returndictionary = [:] return returndictionary } }
i error on
let searchresultsjson: nsdictionary = try nsjsonserialization.jsonobjectwithdata(jsondata, options: .mutablecontainers) as! nsdictionary
is ide thing or have actual error in code??
Comments
Post a Comment