Instance Property

attachments

An array of attachments to display in an alert-based notification.

Declaration

iOS, Mac Catalyst, watchOS
@property(copy, nonatomic) NSArray<UNNotificationAttachment *> *attachments;
macOS
@property(copy, atomic) NSArray<UNNotificationAttachment *> *attachments;

Discussion

Use this property to include images or movies, or to include playable audio files, with the contents of an alert. The system displays the attachments alongside the title and body of your alert. You can also customize the presentation of attachments using a notification content app extension.

All attachments must reside locally on the current device before they can be added. For local notifications, modify this property before scheduling the notification. For remote notifications, use a notification service app extension to locate and download the specified files and modify the notification content before it is delivered.

For more information on how to specify attachments, see UNNotificationAttachment.

See Also

Getting the Notification Data

title

The localized title, containing the reason for the alert.

subtitle

The localized subtitle, containing a secondary description of the reason for the alert.

body

The localized message to display in the notification alert.

badge

The number to apply to the app’s icon.

sound

The sound to play when the notification is delivered.

launchImageName

The name of the custom launch image to display when your app is launched in response to the notification.

userInfo

A dictionary of custom information associated with the notification.