Re: Core Data: Low level retrieving of data
Re: Core Data: Low level retrieving of data
- Subject: Re: Core Data: Low level retrieving of data
- From: Ryan Homer <email@hidden>
- Date: Thu, 25 Jan 2007 15:41:29 -0500
On Jan 25, 2007, at 6:07 AM, Ryan Homer wrote:
It's a lot easier to try to follow what you're doing if you use the
correct terminology.
An entity is not the same as a managed object. You typically do
not create new entities in code, you create new managed objects.
Yes, I meant to say "create a new managed object". Thanks. I'll get
the hang of it soon.
If I do not create the new entity, then when I try to fetch, I'm
not able to retrieve any data from the store. I think part of the
problem (only part) is that I am not using a custom
NSManagedObject in my GUI, but when retrieving I'm trying to use
the custom class in order to use my accessors.
It's not clear what you mean here, however this is unlikely to be
the issue. Core Data *always* uses the same class to represent
instances of a given entity -- the class that you specified for the
entity in the model.
In one area of my code, the my managed object context was created
with NSManagedObjectContext and in the "low-level" code, I was trying
to retrieve it with my custom managed object context. I see my error.
I've tried without and I keep getting "Target does not respond to
this message selector".
Accessing properties is described here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
Articles/cdUsingMOs.html>
If you have a custom managed object class an you have defined
suitable accessor methods, you can invoke those. If you haven't,
you use key-value coding.
The correct data was being returned after all. It's just that I could
not see my actual data in the console. Thanks for pointing out how to
access the properties. After all the reading-up I've done, I kinda
got confused and thought that I could just access them as an instance
variable and that key-coding would come into play. Ouch.
Thanks so much for your help! Let's see how much further I get now.
Ryan
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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