• 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: coding struct with keyed archivers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coding struct with keyed archivers


  • Subject: Re: coding struct with keyed archivers
  • From: Jim Correia <email@hidden>
  • Date: Wed, 15 Jan 2003 08:15:40 -0500

On Wednesday, January 15, 2003, at 07:40 AM, Simon Bovet wrote:

How can I encode a NSValue with e.g. NSPoint value into a NSKeyedArchiver? When trying it straightforward:

NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[[NSKeyedArchiver alloc] initForWritingWithMutableData:data] autorelease];
[archiver encodeObject:[NSValue valueWithPoint:NSZeroPoint] forKey:@"Point"];
[archiver finishEncoding];

I get the following error:

exception: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs


Do I really need to subclass NSValue? Why can't structs be key archived?!?

NSKeyedArchiver doesn't support archiving structs. The reasons why are discussed in the foundation release notes.

Jim
_______________________________________________
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: writeToFile and arrayWithContentsOfFile
  • Next by Date: Re: OpenGL printing/image
  • Previous by thread: Re: Atomic operations in Obj-C?
  • Next by thread: Re: OpenGL printing/image
  • Index(es):
    • Date
    • Thread