• 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: Subclassing NSManagedObject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSManagedObject


  • Subject: Re: Subclassing NSManagedObject
  • From: Marcus Zarra <email@hidden>
  • Date: Tue, 6 Jun 2006 23:28:24 -0600

Can you provide a sample of your getters and setters? Also, are you overriding any other methods from NSManagedObject?

On Jun 6, 2006, at 10:20 PM, David Alter wrote:

I'm using Core Data with a persistent data store. I need to subclass a NSManagedObject for some of the things I want to do. Before I subclassed I had things working using NSManagedObject. Now that I have created a subclass things are no longer working.

I can load up data just fine. The first time the application launches it initializes the persistent data store with some data collected from an external source. This data appears in a NSTableView that I have connected with bindings. That all works great.

The second time I launch the application it reads the data store from disk and creates an object for each record saved to disk, but does not set the values for that record. So now my NSTableView has lots of rows with no data in them.

I'm not sure what I'm missing here. When I subclassed NSManagedObject I changed the following...
1) In the object model I changed the entity to my class name and not NSManagedObject.
2) In my nib I made my control object an entity with the name I used in my Object Model


To debug I have added the method "- (id)initWithEntity: (NSEntityDescription *)entity insertIntoManagedObjectContext: (NSManagedObjectContext *)context" to my subclass of NSManagedObject. I know this is not recommended but I wanted to make sure my class was getting created. It is initializing my subclass but none of my set methods are being called. I'm not clear on how my objects should be initialized with the data from disk. I assumed that it would use set methods and key value coding to set the data.

Could someone please let me know what I'm missing here? Or, some ideas of what I can try to see what is going on.

Thanks for the help
-dave

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Subclassing NSManagedObject (From: David Alter <email@hidden>)

  • Prev by Date: Subclassing NSManagedObject
  • Next by Date: RE: Color Picker implementation error
  • Previous by thread: Subclassing NSManagedObject
  • Next by thread: Re: Subclassing NSManagedObject
  • Index(es):
    • Date
    • Thread