Platforms to show: All Mac Windows Linux Cross-Platform

Back to UNNotificationAttachmentMBS class.

UNNotificationAttachmentMBS.attachment(identifier as String, File as FolderItem, options as Dictionary = nil, byref error as NSErrorMBS) as UNNotificationAttachmentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an attachment object from the specified file and options.

identifier: The unique identifier of the attachment. Use this string to identify the attachment later. If you specify an empty string, this method creates a unique identifier string for you.
URL: The URL of the file you want to attach to the notification. The URL must be a file URL and the file must be readable by the current process. This parameter must not be nil. For a list of supported file types, see Supported File Types.
options: A dictionary of options related to the attached file. Use the options to specify meta information about the attachment, such as the clipping rectangle to use for the resulting thumbnail.
error: An error object indicating whether a problem occurred. If the attachment was created successfully, this parameter is set to nil. If an error occurs, it is set to an error object containing information about why the attachment was not created. You may specify nil for this parameter if you do not want the error information.

Returns an attachment object containing information about the specified file or nil if the attachment could not be created.

This method verifies that the specified file is readable and that the file format is one of the supported types. When errors occur, the method provides an appropriate error object.
When you schedule a notification request containing the attachment, the attachment’s file is moved to a new location to facilitate access by the appropriate processes. After the move, the only way to access the file is using the methods of the UNUserNotificationCenterMBS object.

See also:

UNNotificationAttachmentMBS.attachment(identifier as String, URL as String, options as Dictionary = nil, byref error as NSErrorMBS) as UNNotificationAttachmentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an attachment object from the specified file and options.

identifier: The unique identifier of the attachment. Use this string to identify the attachment later. If you specify an empty string, this method creates a unique identifier string for you.
URL: The URL of the file you want to attach to the notification. The URL must be a file URL and the file must be readable by the current process. This parameter must not be nil. For a list of supported file types, see Supported File Types.
options: A dictionary of options related to the attached file. Use the options to specify meta information about the attachment, such as the clipping rectangle to use for the resulting thumbnail.
error: An error object indicating whether a problem occurred. If the attachment was created successfully, this parameter is set to nil. If an error occurs, it is set to an error object containing information about why the attachment was not created. You may specify nil for this parameter if you do not want the error information.

Returns an attachment object containing information about the specified file or nil if the attachment could not be created.

This method verifies that the specified file is readable and that the file format is one of the supported types. When errors occur, the method provides an appropriate error object.
When you schedule a notification request containing the attachment, the attachment’s file is moved to a new location to facilitate access by the appropriate processes. After the move, the only way to access the file is using the methods of the UNUserNotificationCenterMBS object.

See also:

UNNotificationAttachmentMBS.Available as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether the UNNotificationAttachment class is available.

Returns true on MacOS 10.14 or newer in 64-bit MacOS application.

UNNotificationAttachmentMBS.UNNotificationAttachmentOptionsThumbnailClippingRectKey as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The clipping rectangle for a thumbnail image.

The value of this key is a dictionary containing a normalized CGRectMBS—that is, a unit rectangle whose values are in the range 0.0 to 1.0 and represent the portion of the original image that you want to display. For example, specifying an origin of (0.25, 0.25) and a size of (0.5, 0.5) defines a clipping rectangle that shows only the center portion of the image.

UNNotificationAttachmentMBS.UNNotificationAttachmentOptionsThumbnailHiddenKey as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
A Boolean value indicating whether the attachment’s thumbnail is hidden.

The value of this key is a number containing a Boolean value. When set to true, the attachment’s thumbnail is not displayed. If you do not include this key, the thumbnail is shown.

UNNotificationAttachmentMBS.UNNotificationAttachmentOptionsThumbnailTimeKey as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The frame number of an animation to use as a thumbnail image.

For animated images, the value of this key is an number containing the frame number to use as the thumbnail. For movies, the value of this key is the time (in seconds) into the movie from which to grab the thumbnail image.

UNNotificationAttachmentMBS.UNNotificationAttachmentOptionsTypeHintKey as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method User Notifications MBS MacFrameworks Plugin 19.1 ✅ Yes ❌ No ❌ No ✅ Yes All
A hint about an attachment’s file type.

The value of this key is a string containing a Uniform Type Identifier (UTI) that describes the file’s type. If you do not include this key, the attachment’s filename extension is used to determine its type.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...