I have a NSView
to accept files from all the sources - local and remote. I use NSFilesPromisePboardType
to accept remote files like images dragged from the browser. Here is the code I use to get dropped images to be copied into my folder:
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard * pboard = [sender draggingPasteboard];
NSDragOperation sourceDragMask = [sender draggingSourceOperationMask];
if ([[pboard types] containsObject:NSFilesPromisePboardType])
{
[sender namesOfPromisedFilesDroppedAtDestination:_fileStorageFolder];
return YES;
}
return NO;
}
And now I have noticed 2 issues:
What is the correct way to receive files from browser without any warnings and Finder windows?
Answering my own question. There was nothing wrong with my code. It was the latest version of Google Chrome that opened Finder window after you drag&drop file from the browser to any location on your computer.
I found a bug-report for Google Chrome, tested Opera and Safari - everything is ok.
Sorry for bothering.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With