How to toggle a button using URL?

I am trying to create a Shortcut to turn off Location Services on my iPhone. For this, I am using the settings URL scheme to go into Location Services, but I cannot get a direction on how to toggle the button off.

Is it at all possible to toggle a button using a boolean value in the URL?

I see there are several Set actions like Set WiFi and Set Bluetooth. Can someone help me understand how these functions work in the background?

I’m running iOS 14 on an iPhone 11 Pro Max.


Solution 1:

Apple does not provide the ability to change settings in the Settings app by a URL.

You can only navigate to a page within the app for you to switch the setting yourself as you've found. A URL that could toggle a setting could be a security issue in that the URL could be navigated to by a bad third-party and toggle a setting without your permission.

Actions in the Shortcuts app like the Wi-Fi and Bluetooth toggles use private APIs only available to apps with specific Apple private entitlements.