Instance Method


Adds promises for the specified types to the first pasteboard item.


- (NSInteger)addTypes:(NSArray<NSPasteboardType> *)newTypes owner:(id)newOwner;



An array of NSString objects, each of which specifies a type of data that can be provided to the pasteboard.


The object that provides the data for the specified types.

If the data for those types is provided immediately, the owner can be nil. If the data for the added types will be provided lazily when requested from the pasteboard, an owner object must be provided that implements the -pasteboard:provideDataForType: method of the NSPasteboardOwner informal protocol.

Return Value

The new change count, or 0 if there was an error adding the types.


This method adds promises for the specified types to the first pasteboard item.

You use this methods to declare additional types of data for the first pasteboard item in the receiver. You can also use it to replace existing types added by a previous declareTypes:owner: or addTypes:owner: message.

The newTypes parameter specifies the types of data you are promising to the pasteboard. The types should be ordered according to the preference of the source application, with the most preferred type coming first (typically, the richest representation). New types are added to the end of the list containing any existing types, if any.

If you specify a type that has already been declared, this method replaces the owner of that type with the value in newOwner. In addition, any data already written to the pasteboard for that type is removed.

See Also

Writing Data (OS X v10.5 and Earlier)

- declareTypes:owner:

Prepares the receiver for a change in its contents by declaring the new types of data it will contain and a new owner.

- writeFileContents:

Writes the contents of the specified file to the pasteboard.

- writeFileWrapper:

Writes the serialized contents of the specified file wrapper to the pasteboard.