ios - Archiving NSArray that contains dictionaries -
i trying save nsmutablearray
in coredata
. array contains objects nsdictionary
nsdictionary has following structure
valuedict = { floorid = f0001; endcoordinates = "nspoint: {541, 413}"; linepath = "<uibezierpath: 0x1d0903c0>"; pointsonline = ( ); startcoordinates = "nspoint: {418, 504}"; },
to write core data use following code: parray type binarydata
points.parray = [nskeyedarchiver archiveddatawithrootobject:self.locationsarray];
and retrieve value use
locationsarray = [nskeyedunarchiver unarchiveobjectwithdata:points.parray];
when try retrieve following error :
terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[nsdictionary initwithobjects:forkeys:]: count of objects (0) differs count of keys (5)'
i have checked nsarray , nsdictionary adopts nscoding protocol. doing wrong here ?
the best way solve create either small test app, or test method called when app launches. create typical dictionary using same keys , types, try archive it, log data size, try unarchive data. assuming fails comment out 1 or more keys til what's left works. know problem key , can better determine wrong.
Comments
Post a Comment