Reads from the receiver objects that best match the specified array of classes.
- macOS 10.6+
An array of class objects.
Because this method creates an instance of the first class that can read a given pasteboard item, you can order the classes in
classto match your preferred order of representation. Classes in the array must conform to the
A dictionary that specifies options to refine the search for pasteboard items, for example to restrict the search to file URLs with particular content types. For valid dictionary keys, see Pasteboard Reading Options.
An array containing the best match (if any) for each of the items on the receiver that can be represented by a class specified in
nil if there is an error in retrieving the requested items from the pasteboard, or an empty array if no objects of the specified classes can be created.
class must implement the
NSPasteboard protocol. Cocoa classes that implement this protocol include
NSPasteboard. For every item on the pasteboard, each class in the provided array will be queried for the types it can read using
readable. An instance is created of the first class found in the provided array whose readable types match a conforming type contained in that pasteboard item. Any instances that could be created from pasteboard item data is returned to the caller. Additional options, such as restricting the search to file URLs with particular content types, can be specified with an options dictionary.
Only objects of the requested classes are returned. You can always ensure to receive one object per item on the pasteboard by including the
NSPasteboard class in the array of classes.
Consider the following example: there are five items on the pasteboard, two contain TIFF data, two contain RTF data, one contains a private data type. The following table shows what objects you get back in the returned array for different classes in