Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 929207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:07:54+00:00 2026-05-15T20:07:54+00:00

The documentation for NSPasteboard ‘s -types reads: Return Value An array of NSString objects

  • 0

The documentation for NSPasteboard‘s -types reads:

Return Value

An array of NSString objects
containing the union of the types of
data declared for all the pasteboard
items on the receiver. The returned
types are listed in the order they
were declared.

Despite this, I have an NSPasteboard with only one NSPasteboardItem and [pboard types] returns more types than [item types] returns. Can anyone explain this?

Code

Here’s some code that evidences the problem:

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
    NSPasteboard *pboard = [sender draggingPasteboard];

    // Prove that there's only one item
    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; // Ignore for example
}

Output

When I drag a 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

It looks like [item types] is basically showing the same types as [pboard types], but only the UTI versions. And since [pboard types] seems to be interleaving the UTI types with the corresponding other type (?) of types, it’s basically a mapping…

I could probably ignore this issue by simply using the UTI for the data format I want, but I’m looking for WebURLsWithTitlesPboardType (corresponding to dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k), and I’m wary of those dyn.(...) UTIs. Sounds like something that shouldn’t be hardcoded.

Is there a reliable way of transforming WebURLsWithTitlesPboardType-style identifiers into UTIs? I don’t trust the approach of actually using [pboard types] as a mapping…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:07:55+00:00Added an answer on May 15, 2026 at 8:07 pm

    I’m convinced that documentation for NSPasteboard‘s -types is actually faulty. The correct documentation should be something like:

    An array of NSString objects containing the union of the types of data declared for all the pasteboard items on the receiver, with the addition of old-style, non-UTI type identifiers.

    If you’re targeting OS X 10.6+, you should be able to completely disregard NSPasteboard‘s -types and focus only on each NSPasteboardItem‘s -types, but this requires working exclusively with UTIs.

    To convert a non-UTI type identifier to a UTI you need to use the UTTypeCreatePreferredIdentifierForTag() function; you also need to know what kind of identifier you already have (kUTTagClassFilenameExtension, kUTTagClassMIMEType, kUTTagClassNSPboardType or kUTTagClassOSType). This type is the first argument to the function. The second is the identifier itself (as a CFStringRef). While the documentation suggests that it’s OK to pass NULL for the third argument, it seems to be important to actually pass kUTTypeData when generating these dynamic UTIs.

    For example, to get the (dynamic) UTI for data with the old-style identifier “WebURLsWithTitlesPboardType”:

    CFStringRef webURLsWithTitlesUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, CFSTR("WebURLsWithTitlesPboardType"), kUTTypeData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 475k
  • Answers 475k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In command line options syntax, sometimes [...] is used to… May 16, 2026 at 4:30 am
  • Editorial Team
    Editorial Team added an answer That isn't a non-CLR C++ program. In proper C++, classes… May 16, 2026 at 4:30 am
  • Editorial Team
    Editorial Team added an answer My guess is that it's probably crashing on echo "$conn",… May 16, 2026 at 4:30 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.