I have an NSArraycontroller which is bound to my application's AppDelegate's managedObjectContext. It acts as a download queue. Items are added to the NSArraycontroller programmatically
I have a table which shows two of the fields in this, each a column with its value individually bound to the the said NSArraycontroller. When a new download is started it is removed programmatically from the NSArraycontroller.
I have added a button to remove downloads from the queue before they start, the button is bound to the NSArraycontroller's remove: action which should remove the selected item in the table.
My problem is that when clicking the remove button the selected item does not get removed from the table, it remains there until clicking another entry in the table. Selecting the row where the item was causes it to be selected while the mouse button is held down, as if it is still there, but with no values.
In the console the following appears when the remove button is clicked:
-[NSCFDictionary _setUnprocessedDeletion__:]: unrecognized selector sent to instance 0x2000f2220
If I remove items from the table programmatically using
[[downloadsArray content] removeObjectAtIndex:0];
[downloadsTable reloadData];
[downloadsTable deselectAll:nil];
it seems to work fine, except I still get the invisible item left behind that can be selected and remains selected only when the mouse button is down.
I have bound the remove button's enabled attribute to canRemove of the NSArraycontroller and this works correctly.
I have a label which shows the number of items in the queue, this is bound to NSArraycontroller, arrangedObjects, @count. This works correctly when adding items but not when removing them.
Any ideas on what I'm doing wrong would be much appreciated.