iOS Simulator: add ability to set permission for cross website tracking
Use case
Using the permissions parameter for the launchApp command, I'm able to set all available permissions via the framework. However, the cross-website tracking permission is not available to set. This is problematic because there's no way to accept or dismiss the alert by default (as Appium's frameworks do)
Proposal
It's likely that the framework would need to edit the xctest database to achieve this, as I've been unable to find a way to set the permission via simctl manually. Alternatively, addressing the autoAcceptAlerts requests in the repo would serve the same purpose.
Anything else?
No response
This is different from the usertracking permission?
Yes; this screenshot is taken from a simulator where I applied the all option for permissions.
What version of iOS are you using? Where's this toggle, so that I can play along?
iOS 18.6 / iOS 26 - this particular permission was introduced in iOS 14 I believe. That toggle is in Settings => App => <App Name>. There's a separate group for these two permissions on that UI toggle screen (no idea why), but this is the same screen where you'd see the state of the rest of the permissions for your app.
Cross site tracking is visible for our app because we declare it in our Entitlements, but it's not something I see in simctl help docs.
It's my belief this is an upstream bug from your framework, see the output from xcrun simctl below. However, this does mean there's no real work-around for that particular alert.
xcrun simctl privacy --help
Grant, revoke, or reset privacy and permissions
Usage: simctl privacy <device> <action> <service> [<bundle identifier>]
action
The action to take:
grant - Grant access without prompting. Requires bundle identifier.
revoke - Revoke access, denying all use of the service. Requires bundle identifier.
reset - Reset access, prompting on next use. Bundle identifier optional.
Some permission changes will terminate the application if running.
service
The service:
all - Apply the action to all services.
calendar - Allow access to calendar.
contacts-limited - Allow access to basic contact info.
contacts - Allow access to full contact details.
location - Allow access to location services when app is in use.
location-always - Allow access to location services at all times.
photos-add - Allow adding photos to the photo library.
photos - Allow full access to the photo library.
media-library - Allow access to the media library.
microphone - Allow access to audio input.
motion - Allow access to motion and fitness data.
reminders - Allow access to reminders.
siri - Allow use of the app with Siri.
bundle identifier
The bundle identifier of the target application.
Examples:
reset all permissions: privacy <device> reset all
grant test host photo permissions: privacy <device> grant photos com.example.app.test-host
Warning:
Normally applications must have valid Info.plist usage description keys and follow the API guidelines to request access to services. Using this command to bypass those requirements can mask bugs.
Maestro uses a combination of simctl and applesimutils to set permissions, to try to Catch Em All. But I don't know if this is covered by either yet 😬
Such privacy focus that you can't set the privacy setting. The most Apple of Apple things to do haha
I'm looking at how hard it'd be to extend applesimutils to support this, but require a test app.
I thought that adding this to the test app would be enough to get the toggle to show, but on an iOS 26.2, I still only see "Allow Tracking". Any tips?
This has sent me down a bizarre rabbit hole with creating settings bundles in iOS. I've yet to determine if this is the direction my team took (as I'm more of a test automation expert rather than an iOS engineer) - https://stackoverflow.com/questions/64897054/using-nscrosswebsitetrackingusagedescription-to-request-user-disable-itp-for-wkw
That's what I saw, and hoped would work. Not only did it have no effect, Xcode doesn't even recognise it 🤔
I wonder if the iOS version is relevant, since when I toggle "Allow Tracking" it sounds a lot like Cross-Website Tracking: