• 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
id type in NSCoder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

id type in NSCoder


  • Subject: id type in NSCoder
  • From: Ian McGregor <email@hidden>
  • Date: Wed, 17 Dec 2003 22:30:16 -0800

I have a class which stores a set of titles/values.

@interface MyField : NSObject <NSCoding, NSCopying>
{
NSString *fieldName; // eg assetID
id fieldValue; // eg NSNumber, NSString,
NSCalendarDate
}

and this (which of course is not working because of the id fieldValue):

- (id)initWithCoder:(NSCoder *)coder
{
[super init];
[self setFieldName:[coder decodeObject]];
[self setFieldValue:[coder decodeObject]];
return self;
}

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

any ideas on how I can make this class handle encoding and decoding
fieldValue?

I have been looking for examples on classForCoder and related, but have
not found very much.

Cheers,

Ian
_______________________________________________
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: Re: getting a plist into a dictionary?
  • Next by Date: Re: NSDistributedNotificationCenter
  • Previous by thread: Re: Moving a subview within a view.
  • Next by thread: Re: id type in NSCoder
  • Index(es):
    • Date
    • Thread