How should I remove all items from an NSTableView controlled by NSArrayController?

You don't remove items from a table view. It doesn't have any items—it just displays another object's items.

If you bound the array controller's content array binding to an array property of some other object, then you should be working with that property of that object. Use [[object mutableArrayValueForKey:@"property"] removeAllObjects].

If, on the other hand, you haven't bound the array controller's content array binding, then you need to interact with its content directly. Use [[arrayController mutableArrayValueForKey:@"content"] removeAllObjects]. (You could also work with arrangedObjects instead of content. If one doesn't work, try the other—I've only ever done things the first way, binding the array controller to something else.)


Had this problem as well and solved it this way:

NSArrayController* persons = /* your array controller */;
[[persons content] removeAllObjects];