Re: is nullify causing an exception
Re: is nullify causing an exception
- Subject: Re: is nullify causing an exception
- From: Steve Cronin <email@hidden>
- Date: Wed, 8 Mar 2006 17:38:02 -0600
Miguel
A further clarification: the 'remove' method in the arrayController
does NOT perform a 'deleteObject'!
I need to actually delete the object from the store, not simply
remove it from the array!
Steve
On Mar 8, 2006, at 1:00 PM, Miguel Sanchez wrote:
I'm sorry if I missed it in your email, but what is the error
you're getting? You say that you are dropped into GDB but is that
in a breakpoint for that method? Is an exception raised?
do you need to do the deletion in code? (collecting the selection
and removing from the context). Why not let the detail array
controller do this for you?
- Miguel
On Mar 8, 2006, at 1:29 AM, Steve Cronin wrote:
Folks;
I've got a master-detail implementation in CoreData.
There are inverse relationships:
M has a to-Many relation to D [optional] [Cascade]
D has a to-One relation to M [mandatory] [Nullify]
In a window I have 2 tableViews controlled by 2 arrayControllers.
These are straight unsubclassed arrayControllers each bound to an
entity, both have 'auto prepare content', share the
windowControllers MOC. The contentSet of the detailController is
bound to the 'selection' of the masterController.
If the user selects a master record in the masterTableView, then,
the detail records are displayed in the detailTableView as expected.
So far so good.
I want to allow the user to select detail records for deletion.
So, in the windowController, I collect the selection into an array
and iterate using a for loop [No enumerator]
using: [managedObjectContext deleteObject:(--DetailObject--)]
All is well all through the loop.
However, following the loop I do:[managedObjectContext
processPendingChanges];
At this method I get dropped into the debugger in the methods for
the --Master-- class at:
-'removeDetailsObject:(Detail *)value
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value
count:1];
[self willChangeValueForKey:@"details"
withSetMutation:NSKeyValueMinusSetMutation
usingObjects:changedObjects];
[[self primitiveValueForKey: @"details"] removeObject: value];
[self didChangeValueForKey:@"details"
withSetMutation:NSKeyValueMinusSetMutation
usingObjects:changedObjects];
[changedObjects release];
This is untouched XCode-generated code for the class.
So it seems to me the 'processPendingChanges' is enforcing the
nullify rule by calling this method in the Master.
That's cool!
Yes, the same error happens if I don't do 'processPendingChanges'
and just do 'save'.
In fact, the error occurs if I don't do either 'process' or 'save'
I've got myself convinced that the error is buried in IB somewhere
but right now I just don't get it.
Anybody have any thoughts on what am I doing wrong?
Thanks for any insights!
Steve
_______________________________________________
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
_______________________________________________
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