archiving NSPrintInfo created via initWithDictionary crashes
archiving NSPrintInfo created via initWithDictionary crashes
- Subject: archiving NSPrintInfo created via initWithDictionary crashes
- From: "email@hidden" <email@hidden>
- Date: Fri, 6 Mar 2009 17:21:08 -0800
on 10.5.6 the following code snippet:
NSPrintInfo* sp = [NSPrintInfo sharedPrintInfo];
NSDictionary* dict = [sp dictionary];
NSPrintInfo* pi = [[NSPrintInfo alloc] initWithDictionary: dict];
NSData* piData = [NSKeyedArchiver archivedDataWithRootObject: pi];
will crash with the following:
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[NSKeyedArchiver
encodeValueOfObjCType:at:]: this archiver cannot encode structs'
with the call stack:
#0 0x96772fb4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___
#1 0x96051e3b in objc_exception_throw
#2 0x96772eeb in +[NSException raise:format:arguments:]
#3 0x96772f2a in +[NSException raise:format:]
#4 0x9689935e in -[NSKeyedArchiver encodeValueOfObjCType:at:]
#5 0x96969a71 in -[NSValue encodeWithCoder:]
#6 0x967e6d2d in _encodeObject
#7 0x9685742d in -[NSKeyedArchiver _encodeArrayOfObjects:forKey:]
#8 0x96806146 in -[NSDictionary(NSDictionary) encodeWithCoder:]
#9 0x967e6d2d in _encodeObject
#10 0x946caa14 in -[NSPrintInfo encodeWithCoder:]
#11 0x967e6d2d in _encodeObject
#12 0x967e64a8 in +[NSKeyedArchiver archivedDataWithRootObject:]
#13 0x00001f3e in main at main.m:19
however, the following doesn't crash:
NSPrintInfo* sp = [NSPrintInfo sharedPrintInfo];
NSDictionary* dict = [sp dictionary];
NSPrintInfo* pi = [[NSPrintInfo alloc] initWithDictionary: dict];
[pi description];
NSData* piData = [NSKeyedArchiver archivedDataWithRootObject: pi];
filed as radar #: 6656704
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden