• 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
is nullify causing an exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

is nullify causing an exception


  • Subject: is nullify causing an exception
  • From: Steve Cronin <email@hidden>
  • Date: Wed, 8 Mar 2006 03:29:13 -0600

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


  • Follow-Ups:
    • Re: is nullify causing an exception
      • From: Miguel Sanchez <email@hidden>
  • Prev by Date: Re: Save data as package
  • Next by Date: controlling focus of embedded text fields
  • Previous by thread: Re: Plus and minus images
  • Next by thread: Re: is nullify causing an exception
  • Index(es):
    • Date
    • Thread