Actually if you are using the pasteboardWriterFor.. delegates it will work fine. Unfortunately, NSBrowser has so such API (yet?) so I'm stuck.
I have filed a bugreport and it's being invetigated.
I filed FB5417493 way back in 2019. This NSBrowser bug still exists on macOS Tahoe 26.2 (so nearly 7 years later, happy new year).
I've been avoiding the issue all this time by using the deprecated API:
-(BOOL)browser:(NSBrowser*)browser
writeRowsWithIndexes:(NSIndexSet*)rowIndexes
inColumn:(NSInteger)column
toPasteboard:(NSPasteboard*)pasteboard
{
// Code here....
NSArray <NSURL*>*urls = // get urls for columns/rows..
BOOL didWrite = NO;
if (@available(macOS 10.14,*))
{
NSArray *filenames = [self fileNamesFrommURLs:urls];
// ironically need to use deprecated API on newer OS's
[pasteboard declareTypes:@[NSFilenamesPboardType] owner:self];
didWrite = [pasteboard setPropertyList:filenames forType:NSFilenamesPboardType];
}
else
{
// I can just write urls
didWrite = [pasteboard writeObjects:urls];
}
return didWrite;
}
But I raised the deployment target so now I'm getting warning which I guess I have to suppress. There is no way to provide more than one drag image with NSBrowser without using private API because the delegate method only accepts one image:
-(NSImage*)browser:(NSBrowser*)browser draggingImageForRowsWithIndexes:(NSIndexSet*)rowIndexes inColumn:(NSInteger)column withEvent:(NSEvent*)event offset:(NSPointPointer)dragImageOffset
I'm not sure why there is an "Accepted Answer" on this thread because the accepted answer doesn't answer anything and only asks more questions.