O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: UTIs and the Pasteboard

In Chapter 12, we discussed how UTIs are used by OS X to identify file types. The pasteboard also uses UTIs for this purpose. Although you did not use UTIs directly in this exercise, NSString uses NSPasteboardTypeString as its type when it reads and writes itself from the pasteboard. If you were to log the value of NSPasteboardTypeString, you would find that its value is public.utf8-plain-text.

The hierarchical nature of UTIs enables an application to be broad (public.image) or specific (public.png) when requesting objects from the pasteboard. The system will work out whether a type is permissible based on what types it conforms to.

Custom UTIs

At some point, you will want to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required