Bug when encoding subclasses of NSData?
Bug when encoding subclasses of NSData?
- Subject: Bug when encoding subclasses of NSData?
- From: Jonathan Wight <email@hidden>
- Date: Tue, 16 Dec 2003 15:05:12 -0600
I have a subclass of NSData that I am providing my own NSCoding methods
for. When an object of this class is archived I want to archive extra
information alongside the bytes of the object.
Unfortunately when I try to archive my object only the bytes are
archived and none of my extra information is getting archived. It turns
out that my subclass's -encodeWithCoder method isn't getting called at
all. I can only assume that NSArchiver recognises my object as an
NSData-like object and thinks it knows how to archive it without
bothering to go through encodeWithCoder.
Here's the backtrace of the point in the the code where I _think_ the
object is about to be archived...
#0 -[CMyData bytes] (self=0x5285a0, _cmd=0x9086b8c0) at
/Volumes/Home/schwa/Desktop/DataTest/CMyData.m:48
#1 0x90a2a484 in -[NSData hash] ()
#2 0x90197154 in __CFSetFindBuckets2 ()
#3 0x9019abd4 in CFSetAddValue ()
#4 0x901a30ac in _flattenPlist ()
#5 0x901a323c in _flattenPlist ()
#6 0x901a3198 in _flattenPlist ()
#7 0x901a05e4 in __CFBinaryPlistWriteToStream ()
#8 0x90aae658 in -[NSKeyedArchiver finishEncoding] ()
#9 0x90aac73c in +[NSKeyedArchiver archiveRootObject:toFile:] ()
#10 0x004ddc88 in main (argc=1, argv=0xbffffb80) at
/Volumes/Home/schwa/Desktop/EncryptedObjectTest/main.m:36
Because NSData supports the NSCoder protocol I would expect the
archiving to go through -encodeWithCoder, but as I've found out it
doesn't seem to. This seems like a definite bug to me... Is this a
known bug and are there any work arounds?
Cheers.
Jon.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.