The documentation for NSPasteboard -typesreads:
Return value
An array of NSString objects containing a union of data types declared for the entire cardboard items on the receiver. The returned types are listed in the order in which they were declared.
Despite this, I NSPasteboardonly have one NSPasteboardItemand it [pboard types]returns more types than [item types]. Can anyone explain this?
The code
Here is the code that indicates the problem:
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard = [sender draggingPasteboard];
if ([[pboard pasteboardItems] count] > 1)
return NO;
for (NSString* type in [pboard types])
NSLog(@"Pasteboard type: %@", type);
NSPasteboardItem* item = [[pboard pasteboardItems] objectAtIndex:0];
for (NSString* type in [item types])
NSLog(@"Item type: %@", type);
return NO;
}
Output
When I drag the link from Safari, I get the following output:
Pasteboard type: dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k
Pasteboard type: WebURLsWithTitlesPboardType
Pasteboard type: dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu
Pasteboard type: Apple URL pasteboard type
Pasteboard type: public.url
Pasteboard type: CorePasteboardFlavorType 0x75726C20
Pasteboard type: public.url-name
Pasteboard type: CorePasteboardFlavorType 0x75726C6E
Pasteboard type: public.utf8-plain-text
Pasteboard type: NSStringPboardType
Item type: dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k
Item type: dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu
Item type: public.url
Item type: public.url-name
Item type: public.utf8-plain-text
Wild speculation
, [item types] , [pboard types], UTI. [pboard types], -, UTI (?) , ...
, , , UTI , , WebURLsWithTitlesPboardType ( dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k), dyn.(...) UTI. , .
WebURLsWithTitlesPboardType - UTI? [pboard types] ...