Drag & Drop, a lifelong curse

Steve Mills

OK, so after "modernizing" my app to add multiple drag items (flavor NSPasteboardTypeFileURL) to the drag clipboard instead of just one with multiple flavors (NSFilenamesPboardType and NSURLPboardType), it's come to my attention that files can no longer be dragged from my app to any other app, e.g., dragging to an app in the Dock results in nothing.

I see this in Xcode's console for each item when I call beginDraggingSessionWithItems:event:source:

Sandbox extension data required immediately for flavor public.file-url, but failed to obtain.

The app is sandboxed, has entitlements for com.apple.security.files.bookmarks-app-scope and com.apple.security.files.user-selected.read-write. Folders urls are granted permission by the user, then urls for individual files within those folders can be added to the drag.

So does dragging files from one app to another need some other flavor added? If so, how do I add additional flavors when using the multiple-item scheme instead of using a single drag image with multiple flavors?

I swear, D&D (and pasteboards in general) is always the most complicated thing, no matter how many changes Apple has put it through.

Steve Mills
Drummer, Mac geek

Join cocoa@apple-dev.groups.io to automatically receive all group messages.