• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Encoding/decoding a class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Wait, that's not true... Re: Setting focus to text field in drawer
  • Next by Date: Coding object version with non-keyed (un)archiver
  • Previous by thread: Re: Question about poseAsClass
  • Next by thread: Coding object version with non-keyed (un)archiver
  • Index(es):
    • Date
    • Thread