• 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: Subclassing and Archiving/Unarchiving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing and Archiving/Unarchiving


  • Subject: Re: Subclassing and Archiving/Unarchiving
  • From: Graham Cox <email@hidden>
  • Date: Sun, 25 Sep 2016 22:36:39 +1000

> On 25 Sep 2016, at 8:12 PM, Dave <email@hidden> wrote:
>
> Is there any way that I can get the archiver to just select the Base Class and ignore the extra properties in the Subclass? Or is there a better way of doing this?


You mean the dearchiver.

It can have a delegate (NSKeyedUnarchiverDelegate, https://developer.apple.com/reference/foundation/nskeyedunarchiverdelegate?language=objc). It can be called when it encounters a class it doesn’t recognise, and the delegate can return a different class, for example the base class. It is given a list of the class hierarchy (as strings) so that it can do this easily.

There are also class methods for setting up class substitutions.

You could also add the extra information as a subobject within the base class, and simply ignore it when dearchiving.

—Graham



_______________________________________________

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


References: 
 >Subclassing and Archiving/Unarchiving (From: Dave <email@hidden>)

  • Prev by Date: Re: ITMS-90171 libswiftRemoteMirror.dylib
  • Next by Date: Re: Triggering a segue from code
  • Previous by thread: Subclassing and Archiving/Unarchiving
  • Next by thread: Detecting user termination of an iOS auto-renewing subscription
  • Index(es):
    • Date
    • Thread