How to clear iOS LocationUsage preference from device for testing purposes? - ios

I have an iOS application that requests the user to allow or deny location access for the application.
From what I have read online, these preferences reset automatically every 24 hours. And an alternative would be to test on multiple devices.
Is there any way to clear these preferences manually before I re-run the application in the simulator?

You can reset your location preferences, by following below steps:
1) From your Home screen, go to Settings > General > Reset
2) Select Reset Location & Privacy
Note: This will reset your location warnings for all sites and applications.

Related

How to reset the app tracking transparency status to notDetermined?

I have an iOS app and I want to test the ATT dialog related code.
Once the app is installed, on subsequent reinstalls the user's choice is persisted and the toggle is shown in the settings (Settings > Privacy > Tracking)
Is there any way to mimic the first install and see the ATT dialog?
I tried "Reset Location & Privacy" and "Reset all settings" with the app uninstalled, then installed it again.
iOS device version 14.6
If you just want just to test it out, you can try by giving it a new Bundle ID. This for the system is like a fresh install so you can test the App Tracking Transparency permissions.

(Swift) Location permissions toggle not showing up in settings

I am working on a Swift app that uses location permissions and I am encountering an interesting problem. If Location Services are disabled for the device, and you open the app for the first time the authorization alert view says you must go to settings and enable this. If you go to settings and then enable location services and then go to the apps section in Settings, the Location toggle section is not there, only the Siri & Search section is displayed (see the picture for what I am talking about).
The only way to make that section appear is to kill the app completely and re-open it. Is there anyway I can have that section appear at all times? I am using a Settings.bundle with nothing in the root and I am asking for WhenInUse permissions.

Camera and Photos permission - iOS [duplicate]

In my iOS app I am accessing the user's photo gallery. The first time the user does this, it asks them for permission. Some of my users have reported getting a crash this first time due to the permission request, but it works fine on subsequent tries.
To be able to test this on my own, I need to be able remove the permission from my iPad and have it prompt again. Is there a way to do this either through the iPad/iPhone itself or through code?
Run the Settings app. Go to General, then Reset. Tap on Reset Location & Privacy. This will reset all of your location and privacy settings, not just for your test app. But you are doing this on a development device so that should be OK. This works in the Simulator too.
In iOS 7+, you can go into Settings > Privacy > Photos and explicitly enable or disable access for individual apps.
This is much better than resetting your entire device privacy settings!
Another way is to temporary change Bundle Identifier (CFBundleIdentifier) in Info.plist.
System will treat such app as a new separate app and will display "would like to access your Photos" alert.
Don't forget to revert CFBundleIdentifier after you end testing.

Reset Permissions like Camera for iOS Apps?

When I develop an app for iOS (iPhone/ iPad) and I need to request permissions. When I use the camera I need to request the camera permission. This can only be done once.
Is there a way to reset initial given permissions at least when I develop an app?
In this way I could check different scenarios for requesting the initial app permissions.
Note: I want to get the initial permission request popup message again.
Settings > General > Reset > Reset Location & Privacy.
This will reset all location, camera and microphone permissions.
It cannot be done on a per app basis.
Another way around this is to change your bundle id. With each new bundle id you provide, it is like a fresh install of the app. Remember to change it back to the original bundle id after testing :)
To reset all the Location & Privacy permissions you can go to:
Settings > General > Reset > Reset Location & Privacy
To view what Apps have what services and to turn it off for individual services you can go to:
Settings > Privacy > The service you want to view
Here you can turn off the service for individual apps, note that this doesn't mean you'll get the popup message again it just means that app will not use that service.
What worked for me:
Windows -> Devices And Simulators -> Installed Apps section, remove the app from there using the - button.
This resets the permissions every time with a fresh install afterwards.
If testing on a real device, uninstalling the app seems to work for me.
Another way to reset permissions on iOS simulator is to delete the appropriate database row from the access table in $SIMULATOR_DEVICE_DIRECTORY/data/Library/TCC/TCC.db. This can be done per app / service basis.

Resetting iOS 7 microphone access permission

How do I reset the microphone access permission so that the app will ask for microphone access permission again as if it were downloaded fresh from the App Store?
Reinstalling the app does not accomplish what I need. When I set the permissions in Settings->Privacy->Microphone, I can only turn permissions on or off. I need to reset it so that it asks for permissions again.
You can RESET your privacy settings in iOS Settings.
Settings > General > Reset > Reset Location and Privacy.
NOTE: Privacy settings for all apps will be reset.
At least starting from iOs 7.1.1 there are switches to change access permission for every single app.
Look in: Settings->Privacy, select the kind of subsytem of your interest ( eg: microphone ), you will see your app in the list. Change the value of the selector according to your needs.
Have a nice day, Stefano
If you change your bundle identifier, that'll also reset the permissions for your app.
Permissions for an uninstalled app are reset after a day.
So, if it is not urgent, you can wait for it reset. I know this is not an ideal solution but it is app specific
Following on from Stefano's post - if you'd like to direct your user directly to the microphone settings then you can use:
let app = UIApplication.sharedApplication()
app.openURL(NSURL(string:"prefs:root=Privacy&path=MICROPHONE")!)
(at least on iOS 9 - if the Settings app structure changes, then the link will likely need to change)

Resources