kPasteboardTypeFileURLPromise broken: No way to get drop location in Cocoa
| Originator: | motownavi | ||
| Number: | rdar://14943849 | Date Originated: | 09-Sep-2013 |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | |
| Classification: | Reproducible: |
NSFilesPromisePboardType has a note in the documentation: > On OS X v10.6 and later, use (NSString *)kPasteboardTypeFileURLPromise instead. In Google Chrome 29 I switched from NSFilesPromisePboardType to kPasteboardTypeFileURLPromise. The complaints about how drag-and-drop broke came pouring in, and I had to revert. There are four issues I am reporting; this is one of them. I will update this radar with links to the other three when I am done filing them all. --- There is no documentation for kPasteboardTypeFileURLPromise, but when we look in the header file HIServices/Pasteboard.h we see a list explaining how to use it: * Order of operations on paste or drop […] * 6) The sender's promise callback for kPasteboardTypeFileURLPromise is called. * 7) The sender uses PasteboardCopyPasteLocation to retrieve the paste location, creates the file * and keeps its kPasteboardTypeFileURLPromise promise. PasteboardCopyPasteLocation takes a PasteboardRef. How do you create one from Cocoa, where you have an NSPasteboard*? NSPasteboard isn't bridged with PasteboardRef, so it takes a ton of boilerplate code. An email from cocoa-dev explained the amount of boilerplate required: http://lists.apple.com/archives/cocoa-dev/2012/Feb/msg00706.html The equivalent code in Chrome was twenty lines. Requiring twenty lines of boilerplate code to properly do drag-and-drop is unacceptable. If you want people to use kPasteboardTypeFileURLPromise, you need to provide a Cocoa API, something like: - (NSURL*)pasteLocation;
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!