Instance Method


Attaches arbitrary content to the message.


- (BOOL)addAttachmentData:(NSData *)attachmentData typeIdentifier:(NSString *)uti filename:(NSString *)filename;



Content in the form of an NSData object to attach to the message. Must not be nil.


A valid Uniform Type Identifier (UTI) appropriate for the attachment data. See Uniform Type Identifiers Reference. Must not be nil.


The name to present to the user, in the message UI, for the data attachment.

Return Value

YES if the attachment data was successfully added to the message, or NO otherwise.


This method is especially useful when the attachment you want to add to a message does not have a file system representation. This can be the case, for example, for programmatically composed audiovisual content.

See Also

Managing Attachments

- disableUserAttachments

Disables the camera/attachment button in the message composition view.


Returns an array of dictionaries that describe the properties of an attachment.

- addAttachmentURL:withAlternateFilename:

Attaches a specified file to the message.


The URL for the item that is attached to the message.


The key for the alternate filename for the file-based item attached to the message.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software