ios - Swift NSCoding with NSValue -
isn't nsvalue nsobject ? why crashing on
var coordinatesrawdata = nsvalue(mkcoordinate: coordinates.first!) if coordinatesrawdata != nil { // crashing here. have valid nsvalue object acoder.encodeobject(coordinatesrawdata, forkey: "coordinatesrawdata") }
error log
*** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[nskeyedarchiver encodevalueofobjctype:at:]: archiver cannot encode structs'
but if this
var coordinatesrawdata = nsvalue() acoder.encodeobject(coordinatesrawdata, forkey: "coordinatesrawdata")
there no crash - both nsvalues .. right ?
note, other nscoding / decoding working fine.
i didn't far did. crashed on these 2 lines:
let loc = cllocationcoordinate2d(latitude: 20, longitude: 20) let val = nsvalue(mkcoordinate:loc)
this tells me nsvalue(mkcoordinate:)
broken. , it's not swift issue; same crash using same code translated objective-c.
Comments
Post a Comment