I recently built an app using Tauri where I was trying to access a user's a contacts list using the native macos apis. My code worked in development but the app would crash when bundled and signed.
To make it work, you need to do two things:
Info.plist
placed in the src-tauri
directoryentitlements.plist
file, also placed in the src-tauri
directory.To let Tauri know about the entitlements.plist
file, I had to add it under the "entitlements" section of my tauri.config.json
file. It looked something like this:
"macOS": {
"entitlements": "./entitlements.mac.plist",
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
My Info.plist
looked like this:
<?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>NSContactsUsageDescription</key>
<string>Why your app needs contacts info</string>
</dict>
</plist>
My entitlements.plist
looked like this:
<?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.personal-information.addressbook</key>
<true/>
</dict>
</plist>
This is particular for accessing contact list but I imagine you need to do something similar for webcam, microphone, etc.
Happy building with Tauri!