Encoding/decoding a class
Encoding/decoding a class
- Subject: Encoding/decoding a class
- From: Simon Bovet <email@hidden>
- Date: Tue, 12 Aug 2003 00:35:57 +0200
I was surprised to see that
-[NSCoder de/encodeValueOfObjCType:@encode(Class) at:&aClass];
is actually working even if the file in which it is encoded is decoded
in a later run. This shouldn't be the case, I guess, since aClass is
just a pointer on some hash table containing the addresses of the
selectors, isn't it?!? I should be rather using:
-[NSCoder encodeObject:NSStringFromClass(aClass)]
aClass = NSClassFromString( - [NSCoder decodeObject] )
I was just worried about what is happening if no class by the
corresponding name is currently loaded (see Discussion of
NSClassFromString)? How can I be sure to always be able to use class
selectors (such as +[aClass alloc]) after decoding? Thanks for any help!
_______________________________________________
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.