• 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
Confused between NSCoder and NSArchiver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Confused between NSCoder and NSArchiver


  • Subject: Confused between NSCoder and NSArchiver
  • From: Mark Ogilvie <email@hidden>
  • Date: Sat, 15 Mar 2003 20:37:33 -0500

I've been working with the Oreily book Learing Cocoa with Objective C
(Second edition) and I'm stuck on apoint. In their example where they
archive an object they use this statement

[NSArchiver archiveRootObject:items toFile:[sheet filename]];

items being an array. But even though they have an encodeWithCoder
routine else where in the program

-(void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self name]];
[coder encodeObject:[self price]];
}

(name and price being part of the array.)

I'm not sure when or how it is called. I know I'm missing something
very basic here. I thought it might be because NSArchiver inherits
from NSCoder and uses its methods, but don't those methods have to be
called explicitly?

Thanks Mark
_______________________________________________
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: Retain counts with a dictionary
  • Next by Date: Re: Retain counts with a dictionary
  • Previous by thread: Retain counts with a dictionary
  • Next by thread: Finding an App by file id?
  • Index(es):
    • Date
    • Thread