Mac OS Catalina - camera permission pop up doesn't appear
See original GitHub issue- Version: 22.9.1
- Electron Version: 10.1.5
- Electron Type (current, beta, nightly):current
- Target: DMG
Since upgrading to macOS Catalina 10.15.7 my electron app no longer pops up the OS system dialog that allows a user to grant permission for using the camera/webcam.
The status from systemPreferences.getMediaAccessStatus("camera")
initially comes back as 'not-determined'
.
Then, requesting access to the webcam by calling systemPreferences.askForMediaAccess("camera")
just resolves immediately as false
, without popping up anything.
Subsequent calls to systemPreferences.getMediaAccessStatus("camera")
returns"denied"
. The app no longer appears in the Mac OS security & Privacy preferences pane.
It used to work previously.
Everything else still works, but the pop up not appearing renders the app useless!
Hopefully I’m just missing some sort of plist
key or config somewhere, but I have trawled the internet and can’t find a solution yet. There seem to be a lot of reports of other electron powered apps having issues along the same line.
app code:
let status = systemPreferences.getMediaAccessStatus("camera"); // returns 'not-determined'
...
const permission = await systemPreferences.askForMediaAccess("camera"); // resolves to false, without popping up anything
entitlements.mac.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
</dict>
</plist>
build bit from package.json
"build": {
"productName": "productName",
"publish": [... ],
"afterSign": "scripts/notarize.js",
"appId": "com.electron.productName",
"buildDependenciesFromSource": true,
"mac": {
"category": "public.app-category.productivity",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",
"extendInfo": {
"LSMinimumSystemVersion": "10.12.6",
"NSCameraUsageDescription": "Please give access to your webcam",
"NSAppTransportSecurity": {
"NSAllowsArbitraryLoads": true
}
}
},
"dmg": {
"sign": false
},
}
The app successfully builds and gets signed, and installs, and runs.
I think I’ve got all the right stuff in those config files, and because it all used to work on a previous version of MacOS (High Sierra) I’m not sure what to do. Just a bit stuck, so wondering if anyone has any ideas or can point me in a direction to figure out what’s wrong 🙏
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top GitHub Comments
Ha ha! Then we have shared in the same world of pain! Hope you haven’t spent as long as I did trying to track down the fix 🤣 😭 .
Hope this sorted it for you 👍
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.