When dealing with pasted or dragged data in Cocoa, we receive the passed data on an
NSPasteboard. Prior to v10.6 (Snow Leopard), this pasteboard could only contain a single item, but now it can contain multiple items, which are returned as an
NSArray via the
The data passed in via the pasteboard can be in a variety of types (for instance, a single image could be passed both in JPEG format and TIFF format), and for compatibility reasons these types can be expressed in various ways—they can be MIME types, UTIs, OSTypes, or PboardTypes.
If we want to handle pastes and drags in the proper, modern, multi-item fashion, you’d think we could just iterate over the
-pasteboardItems (each is an
NSPasteboardItem), ask each for its
-types, and handle the data in our preferred format. Unfortunately things aren’t always that simple.