So, I'm used to developing iOS, so I'm very happy with NSFetchedResultsController. However, this is not the case in Mac OS X. I know that I can use NSArrayController as a replacement. I could use this class horribly wrong, but it has worked so far. I initialize the NSArrayController as follows:
NSArrayController* newConversationsController = [NSArrayController new]; newConversationsController.managedObjectContext = context; newConversationsController.entityName = entityName; newConversationsController.sortDescriptors = sortDescriptors; newConversationsController.automaticallyRearrangesObjects = YES; NSError* error = nil; [newConversationsController fetchWithRequest:nil merge:NO error:&error]; NSCAssert(!error, error.description);
Then I listen to the NSManagedObjectContext changes and retrieve and reload the NSTableView as follows:
[self.conversationsController fetchWithRequest:nil merge:YES error:&error]; NSAssert(!error, error.description); [self.tableView reloadData];
As I mentioned earlier, I could use this completely incorrectly, but I do not like to use bindings. Now to the actual problem: another application class can remove the NSManagedObject stored in NSArrayController. NSArrayController instantly releases this remote object and does not allow me to figure out exactly what the object was. The ultimate goal is to find out which object was deleted so that I can animate NSTableView strings.
Hope this is clear what I'm aiming for. Thanks for any help
cocoa core-data appkit nstableview nsarraycontroller
lbrndnr
source share