iphone - Crashed while using NSKeyedArchiver -


i have nsmutablearray , nsstring want archive these , want retrieve array , string out change data inside array , string.

i given this,

for archive,

nsmutabledata *data = [[nsmutabledata alloc]init];                         nskeyedarchiver *archiver = [[nskeyedarchiver alloc] initforwritingwithmutabledata:data];                         [archiver encodeobject:arrayrandomnumberforuser forkey:@"array"];                         [archiver encodeobject:stringbingo forkey:@"string"];                         [archiver finishencoding]; 

for unarchive,

nsdata *data=match.matchdata;     nskeyedunarchiver *unarchiver = [[nskeyedunarchiver alloc] initforreadingwithdata:data];     mutablearray = [unarchiver decodeobjectforkey:@"array"];     stringtakenvalue = [unarchiver decodeobjectforkey:@"string"];     [unarchiver finishdecoding]; 

where, match.matchdata nsdata object getting gamecenter take turn method.

when called take turnmethod crashed. here console window error message.

terminating app due uncaught exception 'nsinvalidargumentexception', reason: ' -[nsxpcencoder encodeobject:forkey:]: coder encodes objects adopt nssecurecoding (object of class 'nskeyedarchiver').'

i not sure think unarchiver returns nsarray, not nsmutablearray. try

mutablearray = [[unarchiver decodeobjectforkey:@"array"] mutablecopy]; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -