Platforms to show: All Mac Windows Linux Cross-Platform
UNNotificationAttachmentMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | User Notifications | MBS MacFrameworks Plugin | 19.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Create a UNNotificationAttachmentMBS object when you want to include audio, image, or video content together in an alert-based notification. When creating the UNNotificationAttachmentMBS object, the file you specify must be on disk, and the file format must be one of the supported types.
You are responsible for supplying attachments before the system displays your notification's alert. For local notifications, add attachments when creating the notification’s content. For remote notifications, use a notification service app extension to download the attached files and then add them to the notification's content before delivery.
The system validates attachments before displaying the associated notification. If you attach a file to a local notification request that is corrupted, invalid, or of an unsupported file type, the system doesn't schedule your request. For remote notifications, the system validates attachments after your notification service app extension finishes. Once validated, attached files are moved into the attachment data store so that they can be accessed by all of the appropriate processes. Attachments located inside an app’s bundle are copied instead of moved.
Supported File Types
Table lists the types of files you can include as an attachment and the supported file formats. The table also lists the maximum size allowed for attachments of each type. An image file may contain a static image or an animated image sequence.
Supported attachment file types
Attachment | Supported file types | Maximum size |
Audio | kUTTypeAudioInterchangeFileFormat, kUTTypeWaveformAudio, kUTTypeMP3 and kUTTypeMPEG4Audio | 5 MB |
Image | kUTTypeJPEG, kUTTypeGIF and kUTTypePNG | 10 MB |
Movie | kUTTypeMPEG, kUTTypeMPEG2Video, kUTTypeMPEG4 and kUTTypeAVIMovie | 50 MB |
When creating an attachment, you can specify optional details about how to present the thumbnail image for the image or movie. Use the UNNotificationAttachmentOptionsThumbnailClippingRectKey option to use only the specified portion of an image as a thumbnail. For animated images and movies, use the UNNotificationAttachmentOptionsThumbnailTimeKey option to select which frame to use for the thumbnail image.
The amount of storage space allocated for attachments is limited for each app. To delete attachments, use the methods of the UNUserNotificationCenterMBS class to remove the notification requests that contain those attachments.
- 4 properties
- property Handle as Integer
- property identifier as String
- property type as String
- property URL as String
- 3 methods
- method Constructor(identifier as String, File as FolderItem, options as Dictionary = nil)
- method Constructor(identifier as String, URL as String, options as Dictionary = nil)
- method copy as UNNotificationAttachmentMBS
- 7 shared methods
- shared method attachment(identifier as String, File as FolderItem, options as Dictionary = nil, byref error as NSErrorMBS) as UNNotificationAttachmentMBS
- shared method attachment(identifier as String, URL as String, options as Dictionary = nil, byref error as NSErrorMBS) as UNNotificationAttachmentMBS
- shared method Available as boolean
- shared method UNNotificationAttachmentOptionsThumbnailClippingRectKey as String
- shared method UNNotificationAttachmentOptionsThumbnailHiddenKey as String
- shared method UNNotificationAttachmentOptionsThumbnailTimeKey as String
- shared method UNNotificationAttachmentOptionsTypeHintKey as String
This class has no sub classes.
Some methods using this class:
- UNMutableNotificationContentMBS.addAttachment(attachment as UNNotificationAttachmentMBS)
- UNMutableNotificationContentMBS.setAttachments(attachments() as UNNotificationAttachmentMBS)
- UNNotificationContentMBS.attachment(Index as integer) as UNNotificationAttachmentMBS
- UNNotificationContentMBS.attachments as UNNotificationAttachmentMBS()
Blog Entries
Release notes
- Version 19.2
- Added copy function to UNNotificationAttachmentMBS class.
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
UNNotificationActionMBS - UNNotificationCategoryMBS