• 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: Core Data copyWithZone error (NSData encoded structs as attributes)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data copyWithZone error (NSData encoded structs as attributes)


  • Subject: Re: Core Data copyWithZone error (NSData encoded structs as attributes)
  • From: Soares <email@hidden>
  • Date: Thu, 26 Apr 2007 17:07:39 +0100

Yes, I could do that, which is probably the best way to go in the long run.
But I need to be able to store a primitive C float array in my Entity as an
attribute. Has anyone done this before?


On 26/04/07, Jon Trainer <email@hidden> wrote:

Instead of storing a serialized struct, could you replace your struct with a Core Data NSManagedObject (entity)? Then store the data as 1- to-1 relationship to your parent entity. Seems this would simplify the work you need to do.

- Jon


On Apr 26, 2007, at 11:18 AM, Fen Soares wrote:

> Hi list,
>
> I'm using a custom object as one of my Core Data attributes. I'm
> using the
> http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
> Articles/cdNSAttributes.htmldocs
> as a guide on how to do this, because my attribute is a non-supported
> type (basically its a class that contains a c-struct)
>
> In my NSManagedObject subclass I implement the awakeFromInsert
> method to
> create a new instance of the object that represents my attribute
> and then
> try to use:
>
> -(void)setMethod(myCustomObject*)value
> {
>    [self willChangeValueForKey:@"attr"];
>    [self setPrimitiveValue:value forKey:@"attr"];
>    [self didChangeValueForKey:@"attr"];
>    [self setValue:[NSKeyedArchiver archivedDataWithRootObject:attr]
>                    forKey:@"attrAsData"];
> }
>
> My custom object contains a single data member which is a struct,
> and the
> error I'm getting is:
>
> -[myCustomObject copyWithZone:]: selector not recognized [self =
> 0x3a5010]
>
>
>
> All I want to do is to be able to store custom objects in my Core
> Data Model
> that contain structs, or more simply. I'd like to have attributes
> in my
> entity that are NSData encoded c-structs (as I believe this is the
> only way
> to make them persistent using Core Data).
>
> I'm using a Obj-C wrapper around my struct at the moment, due to the
> accessors requiring a custom object pointer. I'm new to this so
> could be
> making a real mess of it. Any clarification would be appreciated.
>
> Thanks.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
> 40gmail.com
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >Core Data copyWithZone error (NSData encoded structs as attributes) (From: "Fen Soares" <email@hidden>)

  • Prev by Date: Re: Core Data copyWithZone error (NSData encoded structs as attributes)
  • Next by Date: Re: Creating interface elements with custom layout and look&feel
  • Previous by thread: Re: Core Data copyWithZone error (NSData encoded structs as attributes)
  • Next by thread: Re: Core Data copyWithZone error (NSData encoded structs as attributes)
  • Index(es):
    • Date
    • Thread