Quincey, that helps. Thanks
On Jun 28, 2011, at 1:36 PM, Quincey Morris wrote:
> On Jun 28, 2011, at 08:40, Brad Stone wrote:
>
>> I get the below. Notice the new SRTodoEntity is properly in the todos
>> relationship but there's also a reference to it outside of the SRNoteEntity.
>> Intuitively, I would think there should be only one reference to it inside
>> SRNoteEntity. This is my confusion. Why is it reference twice? How can
>> I prevent that from happening if this isn't normal?
>>
>> po [[self managedObjectContext] registeredObjects]
>> {(
>> <Note> uid:330961758011065
>> creationDate:2009-09-05 13:21:54 -0400
>> modificationDate:2009-09-06 12:41:02 -0400
>> todos:Relationship objects for {(
>> <SRTodoEntity: 0x200483d80> (entity: SRTodoEntity; id: 0x2004121e0
>> <x-coredata://614245CF-F03E-4F43-9D7F-98CDCB2899FA/SRTodoEntity/p1> ; data: {
>> note = "0x2002c4e60
>> <x-coredata://614245CF-F03E-4F43-9D7F-98CDCB2899FA/SRNoteEntity/p1>";
>> todoViewData = nil;
>> })
>> )} on 0x200448360
>> noteData:538
>>
>> <SRTodoEntity: 0x200483d80> (entity: SRTodoEntity; id: 0x2004121e0
>> <x-coredata://614245CF-F03E-4F43-9D7F-98CDCB2899FA/SRTodoEntity/p1> ; data: {
>> note = "0x2002c4e60
>> <x-coredata://614245CF-F03E-4F43-9D7F-98CDCB2899FA/SRNoteEntity/p1>";
>> todoViewData = nil;
>> })
>> )}
>
> You've kinda got hold of the wrong end of this. Core Data is an object graph,
> certainly, and any pointer to a managed object is a "reference" to the
> object. There are references to these objects all over your code -- every
> stack variable pointer is a reference. In the above example, a reference to
> the Todo object exists inside the set of references that represents Note's
> relationship to its Todo's. That makes it a really important reference, but
> it's certainly never the only one.
>
> By sending a 'registeredObjects' message to the managedObjectContext (which
> is *not* an object in the object graph), you've asked it to construct a
> collection (a set, as it happens) of references to Core Data objects it knows
> about. There's no *relationship* from the MOC to the managed objects, it's
> just the MOC's job to know what managed objects are currently in memory.
>
>
_______________________________________________
Cocoa-dev mailing list ([email protected])
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/archive%40mail-archive.com
This email sent to [email protected]