Drag and Drop of NSTokenField stopped working in Catalina
Drag and Drop of NSTokenField stopped working in Catalina
- Subject: Drag and Drop of NSTokenField stopped working in Catalina
- From: Michael Kloske via Cocoa-dev <email@hidden>
- Date: Tue, 30 Jun 2020 12:32:00 +0200
Hello,
in my application I have several NSTokenField - objects that are used to drag
them into a text field to build up a string by some tokens.
However, since Catalina dragging of those NSTokenField - objects does not work
anymore.
In Xcode I get the following message:
"<NSTokenAttachmentCell: 0x6000021fdd10>: There was an exception (There are 2
items on the pasteboard, but 1 drag images. There must be 1 draggingItem per
pasteboardItem.) raised while processing drag. Ignoring…”
For handling the paste board writing I have the following code in my token
objects which implement <NSPasteboardWriting>:
- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard
{
return @[ @“<my.unique.UTI.id>" ];
}
In my window controller, which implements <NSTokenFieldDelegate> I have the
following code:
- (BOOL)tokenField:(NSTokenField *)tokenField
writeRepresentedObjects:(NSArray *)objects
toPasteboard:(NSPasteboard *)pboard
{
return [pboard writeObjects:objects];
}
As I said it worked pretty well until (including) Mojave but stopped working in
Catalina with the above error message.
As I saw in addition to my “my.unique.UTI.id <http://my.unique.uti.id/>” the
TokenField seems to add “utf-8.string” as item as well, that’s why the
pasteboard will have two items instead of one.
Has anyone any idea how to fix that issue?
Best regards,
Michael
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden