• 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
Re: NSEncoder question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSEncoder question


  • Subject: Re: NSEncoder question
  • From: "Erik M. Buck" <email@hidden>
  • Date: Sat, 6 Oct 2001 08:53:11 -0500

If your class implements the NSCoding protocol and its super class does not,
then -initWithCoder: should be implemented to call the super class'
designated initializer. If the super class does conform to NSCoding
then -initWithCoder: should be implemented to call the super
class's -initWithCoder:.

NSObject does not conform to NSCoding. As it happens, the NSObject class'
designated initializer is the -init method. NSObject's -init does not do
anything and NSObject has no instance variables other than isa which is
initialized by +alloc in the Objective-C run-time. Although it is
technically not necessary to call NSObject's init method in the current
implementation, I suppose that could change some day. It could even change
due to +poseAsClass: in which init does something. For safety and
consistency, follow the rules and call the super class' designated
initializer even when subclassing NSObject.

Maybe the examples should be changed if they don't follow the rules.


References: 
 >NSEncoder question (From: Jeff LaMarche <email@hidden>)

  • Prev by Date: NSEncoder question
  • Next by Date: Re: global default for NSLayoutManager selection threshold?
  • Previous by thread: NSEncoder question
  • Next by thread: Expanded Cocoa Framework for QT
  • Index(es):
    • Date
    • Thread