I have a macOS app that captures screen images. The first time I run this application, a dialog is shown directing the user to give my app Screen Recording permission. Is there a way I can trigger this dialog earlier and detect whether the permission was granted?
Replies
Is there a way I can trigger this dialog earlier … ?
CGRequestScreenCaptureAccess
Is there a way I can … detect whether the permission was granted?
CGPreflightScreenCaptureAccess
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
-
CGRequestScreenCaptureAccess is listed available since macOS 10.15. It works as expected on macOS Big Sur, but our application crashes when running on Mojave (tested two machines running 10.15.6 and 10.15.7). The crash is due to the _CGRequestScreenCaptureAccess symbol not being found.
Is this expected behaviour?
-
Being marked as available in MacOS 10.15, while last Mojave is 10.14.6, means that crash is normal. You have to wrap the call to the API by @available(OSX 10.15)
-
Sorry, I mistakenly wrote Mojave instead of Catalina (the version numbers are 10.15.x). The call is wrapped with @available(macos 10.15, *).
our application crashes when running on
Mojave10.15
Indeed. This is a bug (r. 72786842). The functions were supposed to be available on 10.15.x but something went wrong with the way that was implemented. The workaround is to restrict your use of them to macOS 11 and later.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
-
Could Apple just update the developer documentation to show the correct availability (in this case macOS 11+) on the affected methods?
I also meet this bug. Please fix this bug in the next macOS Catalina release.
-
@tualatrix It is fixed in 11. I do doubt there will be any change in 10.15. Just do what eskimo advised.
I do doubt there will be any change in 10.15.
Right. While it’s impossible to predict the future with 100% reliability, I’d be very surprised if this bug were fixed in a future 10.15.x update. In general we only update older OS releases to fix critical security issues, and that’s not the case here.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"