Hi All, I was playing around with dragging items into NSTableView and I ran into a interesting problem. When I drag an item into my table, the following delegate gets called.
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation { [self performInsertWithDragInfo:info row:row]; return YES; } Since I am returning YES, we are accepting this drop. In "performInsertWithDragInfo", I have a requirement to save the new add into a file and then parse through NSArray which is my data source and might make some modifications. After the modifications, I reload the datasource and repopulate the tableview. [_tableContents removeAllObjects]; for (NSString *fileStr in filtered) { NSURL *fileURL = [NSURL URLWithString:[fileStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; DesktopEntity *entity = [DesktopEntity entityForURL:fileURL]; if ([entity isKindOfClass:[DesktopEntity class]]) [_tableContents addObject:entity]; } [ltableView reloadData]; This is bad idea as I am doing this inside " performInsertWithDragInfo" before I return from tableView:(NSTableView *)tableView acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation which looks wrong to me. However I did not observe any issues on 10.9 where I extensively tested this. When I ran the same code on 10.7 I started noticing issues. May 16 09:49:55 Mac-107-Test-Machine GUD[13022]: *** Assertion failure in -[NSTableRowData _addRowViewForVisibleRow:withPriorView:], /SourceCache/AppKit/AppKit-1138.51/TableView.subproj/NSTableRowData.m:2484 May 16 09:49:55 Mac-107-Test-Machine GUD[13022]: Row 1 should be in the valid visible section I don't know why this is not seen in 10.9. Is there any delegate that would get called after acceptDrop? In the documentation I saw tableView:draggingSession:endedAtPoint:operation: but I don't think its relevant here. Am I missing something? Regards, Varun _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com