Duplicate records adding to an NSTableView + NSArrayController
Duplicate records adding to an NSTableView + NSArrayController
- Subject: Duplicate records adding to an NSTableView + NSArrayController
- From: Darren Wheatley <email@hidden>
- Date: Thu, 26 May 2011 14:05:33 +0100
Hi,
I have an NSTableView bound to an NSArrayController, itself bound to a Core Data store.
The app is working as expected, with two exceptions:
1. Duplicate records:
I have an "add" button bound to arraycontroller.insert
I have created a newObject method to allow me to define default values, which works fine. When I click add a new record gets inserted, but it appears twice in the NSTableView. However, if I save the moc, close and reopen the application only one record is present.
So although it looks like two duplicate records are added, only one is actually present.
Can anyone tell me why two records are visible when I add a new record, but not on subsequent runs of the application?
2. Calculating max records
Within my "newObject" method I perform a fetch on the moc to determine the MAX value for the "ID" field.
This works fine, but the @max.id value is not updated unless I save the MOC after adding each new record. If I don't save the moc the max: function returns the same value as for the previous run.
Unless I am missing something obvious all of my objects use the same moc (defined centrally, and then passed around).
Can anyone suggest why the max: function is only working properly after a moc save?
Thanks in advance
Darren.
_______________________________________________
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