Disfunctional Archivers

MacOS 10.15.3

Has any progress been made on these new archivers to make them actually work for non-secure archiving? i'm still using the deprecated methods because the new NSKeyedUnarchiver using "NO" for secure coding doesn't work. This is in a core data managed object awakeFromFetch. I've put in a compiler switch to flip between these types of archived data blocks for testing.


NSError *error;

self.primitivePropsData = [NSKeyedArchiver archivedDataWithRootObject:[NSDictionary dictionaryWithDictionary:theProps] requiringSecureCoding:NO error:&error];

if(error != nil)

NSLog(@"%@", error.description);



NSError *error;

archivedDict = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:propsData error:&error];

if(error != nil)

NSLog(@"%@", error.description);


It complains of getting an NSValue:


2020-03-19 13:47:57.502593-0500 iQPresenter[16029:9943402] Error Domain=NSCocoaErrorDomain Code=4864 "value for key 'NS.objects' was of unexpected class 'NSValue'. Allowed classes are '{(

NSDictionary

)}'." UserInfo={NSDebugDescription=value for key 'NS.objects' was of unexpected class 'NSValue'. Allowed classes are '{(

NSDictionary

)}'.}

Try using these for dictionaries. They work for me.


NSData *myData = [NSPropertyListSerialization dataWithPropertyList:myDictionary format:NSPropertyListXMLFormat_v1_0 options:0 error:nil];

NSDictionary *myDictionary = [NSPropertyListSerialization propertyListWithData:myData options:NSPropertyListMutableContainersAndLeaves format:NULL error:outError];
Disfunctional Archivers
 
 
Q