Mac Catalyst How to Play NSBeep

Is there a way to play NSBeep() from the Mac Catalyst environment? Thanks in advance to anyone who answers.

Replies

NSBeep() and AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert) seem to play the same sound. kSystemSoundID_UserPreferredAlert isn't available under Mac Catalyst but it has a value of 0x00001000. The following code works under Mac Catalyst (at least in my tests with macOS 13.4).

AudioServicesPlayAlertSound(0x00001000); // same sound as NSBeep()

You may need to import AudioToolbox.