• 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
How to store NSRect as Core Data attribute?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to store NSRect as Core Data attribute?


  • Subject: How to store NSRect as Core Data attribute?
  • From: Daniel Thorpe <email@hidden>
  • Date: Wed, 2 Apr 2008 12:28:23 +0100

Hello everyone,

I'm trying to get to grips with non-standard persistent attributes in Core Data. I've read through the docs I can find (http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html ) but I'm still having some issues storing an NSRect in an entity. I've set the type to be transformable, and left the value transformer field empty using the model editor.

To actually set and get the NSRect values, I've been using NSValue's valueWithRect: and rectValue methods. However, when CD trys to saving the entities to the store, I get this error:

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

I've also changed the property defined in the header file for the entity to:
@property(retain) NSValue *extent;


from
@property(retain) id extent;

What am I doing wrong here? The docs seem to suggest for KVO/KVC compliant structs, NSRect, NSPoint, NSSize and NSRange, you don't need to overwrite the getters and setters?

Any help is much appreciated!

Cheers
Dan


_______________________________________________

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: How to store NSRect as Core Data attribute?
      • From: Ben Lachman <email@hidden>
    • Re: How to store NSRect as Core Data attribute?
      • From: Felix Franz <email@hidden>
  • Prev by Date: Problem with Grouping the rotated object.
  • Next by Date: Re: Need for a creator code?
  • Previous by thread: Re: Problem with Grouping the rotated object.
  • Next by thread: Re: How to store NSRect as Core Data attribute?
  • Index(es):
    • Date
    • Thread