NSCollectionView namesOfPromisedFilesDroppedAtDestination raises exception

Hi All,


I'm refactoring my app to ditch the venerable IKImageBrowserView in favour of the new NSCollectionView. So far so good but I'm having some troubles with namesOfPromisedFilesDroppedAtDestination methods.


Basically, the new method introduced in 10.11


- (NSImage *)collectionView:(NSCollectionView *)collectionView draggingImageForItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths withEvent:(NSEvent *)event offset:(NSPointPointer)dragImageOffset NS_AVAILABLE_MAC(10_11);


is never called and when I try to drag something outside my application, I see this error in the debugger console:


*** Ignoring exception 'NSGenericException' (reason 'NSFilesPromisePboardType was specified, but delegate *** does not implement collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:') raised by <PCCollectionView: 0x1044c7830> during a dragging session


So I have tried to implement the old one


- (NSArray<NSString *> *)collectionView:(NSCollectionView *)collectionView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropURL forDraggedItemsAtIndexes:(NSIndexSet *)indexes NS_AVAILABLE_MAC(10_6);


but indexes is always nil no matter what I drag and number of sections whitin the view.


Did I miss something?


Regards,


Andrea

Replies

Same problem here. Seems like a bug.