app_privacy
Manages privacy permissions for applications on a simulator device. You can grant or revoke specific permissions (such as camera, location, or contacts) for a given app, or reset all permissions to their default state. This eliminates the need to manually interact with system permission dialogs during automated testing and development workflows.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deviceId | string | Yes | — | The UDID of the target simulator device. |
action | enum | Yes | — | The privacy action to perform. One of: "grant", "revoke", "reset". |
service | enum | Yes | — | The privacy service to modify. One of: "all", "calendar", "contacts-limited", "contacts", "location", "location-always", "photos-add", "photos", "media-library", "microphone", "motion", "reminders", "siri", "speech-recognition", "camera", "faceid", "health", "homekit", "usertracking". |
bundleId | string | No* | — | The bundle identifier of the target app. Required when action is "grant" or "revoke". Optional for "reset" (omit to reset all apps). |
Usage Examples
Section titled “Usage Examples”Grant camera access
Section titled “Grant camera access”“Allow the WeatherApp to use the camera without showing a permission dialog.”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "action": "grant", "service": "camera", "bundleId": "com.example.weatherapp"}Grant location-always permission
Section titled “Grant location-always permission”“Give the running app background location access.”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "action": "grant", "service": "location-always", "bundleId": "com.example.weatherapp"}Revoke photo library access
Section titled “Revoke photo library access”“Remove photo library permission so I can test the denied state.”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "action": "revoke", "service": "photos", "bundleId": "com.example.weatherapp"}Reset all permissions for an app
Section titled “Reset all permissions for an app”“Reset all privacy permissions for the shopping app to test the first-launch experience.”
{ "deviceId": "A1B2C3D4-E5F6-7890-ABCD-1234567890EF", "action": "reset", "service": "all", "bundleId": "com.example.shopapp"}Reset all permissions for all apps on the simulator
Section titled “Reset all permissions for all apps on the simulator”“Clear all privacy permission states on this simulator.”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "action": "reset", "service": "all"}Grant multiple permissions in sequence
Section titled “Grant multiple permissions in sequence”“Set up the app with contacts and calendar access for integration testing.”
First call:
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "action": "grant", "service": "contacts", "bundleId": "com.example.weatherapp"}Second call:
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "action": "grant", "service": "calendar", "bundleId": "com.example.weatherapp"}Example Output
Section titled “Example Output”Privacy permission updated.Device: F3A1B2C3-D4E5-6789-ABCD-EF0123456789Action: grantService: cameraBundle ID: com.example.weatherappRelated Tools
Section titled “Related Tools”app_launch— Launch the app after configuring its permissions.app_terminate— Restart the app to ensure permission changes take effect.app_install— Install the app before setting its permissions.simulator_erase— Fully reset the simulator, which also clears all permissions.