Permissions (macOS TCC) — AmoyFeels Engine
If your game touches the microphone, camera, screen capture, accessibility, input
monitoring or the user's files, macOS will gate it behind TCC (Transparency, Consent
and Control). Getting this wrong does not degrade gracefully — a permission request can
terminate your process. This guide is the checklist. The engine's
AmoyFeels.Permissions package hides the API differences, but packaging is your job.
The two rules that break builds
Usage-description keys are mandatory at request time. Before you ever call
PermissionService.Requestfor microphone or camera, your app bundle'sInfo.plistmust contain:NSMicrophoneUsageDescriptionNSCameraUsageDescription
macOS terminates the process when a TCC prompt would be shown without the matching key. (Accessibility, Screen Recording and Input Monitoring take no usage key.) Verify exact key naming against current Apple docs for your target OS.
TCC grants follow your code signature. An unsigned binary has an ad-hoc identity, and moving or replacing the binary can silently reset granted permissions. Ship signed and notarised; expect re-prompts after updates only if the signature identity changes.
PermissionService API (sketch)
using AmoyFeels.Permissions;
var permissions = new PermissionService(new MacOsPermissionBackend());
// Query never prompts — safe to call at startup for UI decisions.
var status = permissions.Query(PermissionKind.Microphone);
// Request may prompt ONCE (or route to Settings — see the table).
var result = permissions.Request(PermissionKind.Microphone);
// result.Status, result.PromptShown, result.SettingsDeepLink
permissions.OpenSettings(PermissionKind.Microphone); // deep-links where possible
- Kinds (8):
Accessibility,ScreenRecording,InputMonitoring,Microphone,Camera,Notifications,UserFiles,RemovableVolumes. - Statuses:
Granted,Denied,NotDetermined,Unavailable,RequiresOsSettings. PermissionService.IsSupportedtells you whether a real backend exists for the OS;UnsupportedPermissionBackendreportsUnavailablefor every kind (never crashes).- Testing seam: implement
IPermissionBackend(andISettingsOpener) with fakes so your tests never trigger real prompts.
What each kind does on macOS
| Kind | Query | Request | Notes |
|---|---|---|---|
Accessibility |
real (AXIsProcessTrusted) |
real (prompt via options dictionary) | No usage key. |
ScreenRecording |
real (preflight API) | real (one-shot prompt) | No usage key. |
InputMonitoring |
real (preflight API) | real (one-shot prompt) | No usage key. |
Microphone |
real (AVFoundation via objc) | Settings fallback | Usage key required. The real one-shot request needs objc block bridging (future engine work) — today the engine opens the Settings pane. |
Camera |
real (AVFoundation via objc) | Settings fallback | Same as microphone: NSCameraUsageDescription required. |
Notifications |
honest NotDetermined |
Settings fallback | The system API is async/block-based; not wired in v1. |
UserFiles |
honest NotDetermined |
no prompt (returns the Settings link) | Use the folder-picker pattern instead (below). |
RemovableVolumes |
Unavailable |
— | Not a runtime permission — see the sandbox entitlement below. |
Status honesty caveat: the macOS preflight APIs cannot distinguish "never asked" from
"denied" in every case; both may report as NotDetermined. Treat any status other
than Granted as "show your help UI" rather than assuming the user was never asked.
The folder-picker pattern for user files
TCC has no "query user files permission" API. The engine-side pattern that avoids prompts
entirely: when the player picks a folder through the system folder picker
(AmoyFeels.NativeFileDialog-style or NSSavePanel/NSOpenPanel on macOS), the grant
travels with that folder — no NSDocumentsFolderUsageDescription-style prompt is
needed for picker-granted locations. Prefer picker-granted saves over writing into
TCC-protected locations (~/Documents, ~/Downloads, ~/Desktop).
Sandbox entitlements (RemovableVolumes)
If your game is sandboxed and should read/write USB drives, the entitlement is
com.apple.security.files.removable-volumes.read-write. This is a build-time
entitlement, not a runtime prompt — which is why RemovableVolumes reports
Unavailable at runtime.
Full Disk Access
There is no request API for Full Disk Access — it is granted only in
System Settings → Privacy & Security → Full Disk Access. It is deliberately not one of
the PermissionKind values; if your game truly needs it (almost none do — prefer the
folder picker), direct the player to Settings.
Packaging checklist
- [ ]
NSMicrophoneUsageDescription/NSCameraUsageDescriptioninInfo.plist(if used) - [ ] Game signed + notarised (stable TCC identity across updates)
- [ ] Saves go through the folder picker (or your app-support dir), not TCC-protected folders
- [ ]
RemovableVolumesentitlement only if you actually need it - [ ] Any status ≠
Grantedhas player-facing help text (and an "Open Settings" button —PermissionService.OpenSettings)
See also: SUPPORT-MATRIX.md (permissions support status) · GETTING-STARTED.md · LICENSING-AND-ATTRIBUTION.md