Open NSAlert in a Smart Card Extension

Hi,

I would like to know if its possible to open an NSAlert or some kind of customized window to ask for pin in a smartcard extension in macos.

I'm developing an cryptotoken kit smartcard extension and i would like to open a customized pin window to ask the pin or OTP for a user. But when i try to open a simple nsalert, the console informs me the following error:

NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'

To this simple code:

NSAlert* msgBox1 = [[NSAlert alloc] init];
   
  [msgBox1 setMessageText: @"Welcome !"];
  [msgBox1 addButtonWithTitle : @"OK"];
  [msgBox1 runModal];

This is in the tokensession.m, signData method.