FROM : Ben Lachman
DATE : Wed Apr 02 18:12:41 2008
I think the easiest way to encode/decode NSRects for storage is
NSStringFromRect() and NSRectFromString(). Then you can just
implement a custom accessor for the property that converts in the
direction you need.
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
<email_removed>
740.590.0009
On Apr 2, 2008, at 7:28 AM, Daniel Thorpe wrote:
> 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_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Wed Apr 02 18:12:41 2008
I think the easiest way to encode/decode NSRects for storage is
NSStringFromRect() and NSRectFromString(). Then you can just
implement a custom accessor for the property that converts in the
direction you need.
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
<email_removed>
740.590.0009
On Apr 2, 2008, at 7:28 AM, Daniel Thorpe wrote:
> 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_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Daniel Thorpe | Apr 2, 13:28 | |
| Felix Franz | Apr 2, 15:11 | |
| Ben Lachman | Apr 2, 18:12 | |
| Thomas Engelmeier | Apr 2, 18:58 | |
| Uli Kusterer | Apr 2, 19:33 | |
| Daniel Thorpe | Apr 3, 11:31 | |
| Adam P Jenkins | Apr 9, 07:16 | |
| stephen joseph but… | Apr 9, 07:30 | |
| Adam P Jenkins | Apr 9, 14:43 |






Cocoa mail archive

