Re: NSArrayController "Auto Rearrange Content" causes "Cannot remove an observer for key path" error
Re: NSArrayController "Auto Rearrange Content" causes "Cannot remove an observer for key path" error
- Subject: Re: NSArrayController "Auto Rearrange Content" causes "Cannot remove an observer for key path" error
- From: Tristan Celder <email@hidden>
- Date: Fri, 26 Jun 2009 10:34:31 +0100
Hey Steve,
Thanks for your reply. Yeah, that's exactly it... the interface just
falls apart after the exception is raised. The workaround I ended up
using in the end was calling arrangeObjects manually and turning off
auto arrange content completely. Not ideal, but it works...
Cheers, Tristan.
On 25 Jun 2009, at 23:51, Steve Steinitz wrote:
Hi Tristan
On 25/6/09, email@hidden wrote:
Is there something I must do with CoreData to ensure KVO
compliance when using auto rearrange content? I have a small
project I've created to demonstrate this issue if anyone would
care to take a look...
I've moaned about this several times on this list. The biggest
problem is not the exception itself (which I now handle by forcing a
relaunch of the app) but the fact that once the exception occurs the
app doesn't work properly: selections don't work etc.
You can look for KVO transgressions until your eyes bleed and still
not prevent the exception. One thing that's given me some relief is
to enhance the default setters for many-to-one relationships like
this one where a Sale sets its Customer:
- (void)
setCustomer: (Customer*) customer
{
Customer * oldCustomer = [self customer];
if (nil != oldCustomer && [customer isNotEqualTo: oldCustomer])
{
[oldCustomer removeSalesObject: self];
}
[super setCustomer: customer];
}
Good luck. You might want to leverage the work you've already done
on your test project by submitting it with a bug report. Word is
Apple knows about the grief this is causing but another report can
only help.
Best regards,
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden