Error when reading NSAttributedString from UITextPasteItem

In order to support a custom paste behaviour, In my UITextView, which I set as its own UITextPasteDelegate in awakeFromNib(), I implemented textPasteConfigurationSupporting(_:,transform:).

When pressing the paste button above the software keyboard, in the callback of item.itemProvider.loadItem(forTypeIdentifier: UTType.rtf.identifier) I get an error

Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.rtf" UserInfo={NSLocalizedDescription=Cannot load representation of type public.rtf, NSUnderlyingError=0x28374e8e0 {Error Domain=PBErrorDomain Code=13 "Operation not authorized." UserInfo={NSLocalizedDescription=Operation not authorized.}}}

even though the item.itemProvider.registeredTypeIdentifiers are

"iOS rich content paste pasteboard type", "Apple Web Archive pasteboard type", "com.apple.uikit.attributedstring", "com.apple.rtfd", "com.apple.flat-rtfd", "public.utf8-plain-text", "public.rtf", "public.html", "com.apple.WebKit.custom-pasteboard-data"

and item.itemProvider.canLoadObject(ofClass: NSAttributedString.self) returns true.

Even item.itemProvider.loadObject(ofClass: NSAttributedString.self) returns a similar error:

Error Domain=NSItemProviderErrorDomain Code=-1200 "Could not coerce an item to class NSAttributedString" UserInfo={NSLocalizedDescription=Could not coerce an item to class NSAttributedString, NSUnderlyingError=0x283497b70 {Error Domain=PBErrorDomain Code=13 "Operation not authorized." UserInfo={NSLocalizedDescription=Operation not authorized.}}}.

Error when reading NSAttributedString from UITextPasteItem
 
 
Q