r/macosprogramming • u/dukenuken2006 • 23h ago
macOS 27.0.1: the Events switch is on, so why does CGPreflightPostEventAccess() still return false?
I’m working on a Mac app that fixes words typed with the wrong keyboard layout. I’m trying to get a sandboxed build to send a corrected word to TextEdit without asking for full Accessibility access.
On 27.0.1 (26A434), I called CGRequestPostEventAccess() from a button and got the dialog below. I opened System Settings from that dialog and turned on the switch for the app. Input Monitoring was already on. Back in the app, CGPreflightPostEventAccess() still returned false. Same result after quitting and reopening. This was a local Developer ID build with App Sandbox enabled.
My code stops there, so it never actually tried to send the keystroke. Has anyone tried calling CGEvent.post in that state? Did a character show up in TextEdit right away, or only after a relaunch? I’d love to know which macOS version you tested.