• 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: Managed Object with Transformable Attribute (C Struct)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Managed Object with Transformable Attribute (C Struct)


  • Subject: Re: Managed Object with Transformable Attribute (C Struct)
  • From: Richard Somers <email@hidden>
  • Date: Tue, 15 Dec 2009 21:11:42 -0700

On Dec 15, 2009, at 6:36 PM, Jerry Krinock wrote:

Concentrate on this one:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/codingctypes.html

Ok. I changed -transformedValue: of the custom value transformer to look like this.


     - (id)transformedValue:(id)value
     {
         Foo foo;
         [value getValue:&foo];
         NSMutableData *data = [NSMutableData dataWithCapacity:64];
         NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]
              initForWritingWithMutableData:data];
         [archiver encodeDouble:foo.e.a forKey:@"e.a"];
         [archiver encodeDouble:foo.e.b forKey:@"e.b"];
         [archiver encodeDouble:foo.e.c forKey:@"e.c"];
         [archiver encodeDouble:foo.e.d forKey:@"e.d"];
         [archiver encodeDouble:foo.f.a forKey:@"f.a"];
         [archiver encodeDouble:foo.f.b forKey:@"f.b"];
         [archiver encodeDouble:foo.f.c forKey:@"f.c"];
         [archiver encodeDouble:foo.f.d forKey:@"f.d"];
         [archiver finishEncoding];
         return [NSKeyedArchiver archivedDataWithRootObject:value];
     }

When I save the document I get an error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs.

Any ideas what's wrong?

--Richard

_______________________________________________

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


  • Follow-Ups:
    • Re: Managed Object with Transformable Attribute (C Struct)
      • From: Graham Cox <email@hidden>
References: 
 >Managed Object with Transformable Attribute (C Struct) (From: Richard Somers <email@hidden>)
 >Re: Managed Object with Transformable Attribute (C Struct) (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: App works when launched from Xcode, not from Finder
  • Next by Date: Re: Managed Object with Transformable Attribute (C Struct)
  • Previous by thread: Re: Managed Object with Transformable Attribute (C Struct)
  • Next by thread: Re: Managed Object with Transformable Attribute (C Struct)
  • Index(es):
    • Date
    • Thread