Issue with CFUserNotificationDisplayAlert on macOS BigSur

I am intending to show an alert message in macOS through a C++ based application. I am using CFUserNotificationDisplayAlert for the same. Below is the piece of code that I have used to display the alert window which I have written in the .mm file:

CFOptionFlags cfRes;

CFUserNotificationDisplayAlert(0, kCFUserNotificationCautionAlertLevel,
                NULL, NULL, NULL,
                CFSTR("Message Header"),
                CFSTR("Message Body"),
                CFSTR("Ok"),
                NULL,
                NULL,
                &cfRes);

The above works fine on Catalina but does not show the alert window in BigSur. Is there anything I am missing ?

Issue with CFUserNotificationDisplayAlert on macOS BigSur
 
 
Q