Reset Permissions like Camera for iOS Apps? - ios

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.

Related

Is there a way to make a permission request for opening app from another app appear again after allowing it once? (iOS)

So we have a task that app1 needs to copy some data to clibboard then open app2 which reads this data from clipboad and uses it. This is already implemented and works. But the first time app1 need to access app2 iOS wanted me confirm that action with the following dialog: "app1 wants to open app2" with options to Open or Cancel. I pressed Open and now it never shows this dialog. However we need this dialog because we want to thorougly test this process, including the case when user presses Cancel. Is there any way to bring this dialog back without wiping our iphones?
We have tried:
Reinstalling both app1 and app2
Restarting device
Enabling and disabling developer mode (ios 16)
Enabling and disabling lockdown mode (ios 16)
Changing system time forward
None of these actions made this dialog to appear again. Wiping and reactivating and iphone will work of course but maybe there is a faster way?
Try deleting "app1" before re-installing it. When you just install a new app over the old one, the data associated with the old one remains in place. Deleting the app first should remove it and hopefully remove the permission to launch "app2" in the process.
Try the following:
Open the iPhone Settings app
Select "General"
Select "Transfer or Reset iPhone"
Select "Reset"
Select "Reset Location & Privacy"
If that doesn't work, select "Reset All Settings"

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.

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

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.

Accidentally overwrote iPhone device location via Xcode

So I'm working on a location-based iPhone app. I'm mainly testing on the iOS simulator, and as such using the Core Location Simulation. All good - I can pretend to be in New York or San Francisco or wherever.
Then I move to testing my app on my iPhone, with that checkbox still enabled. I go for a walk (in, like, the actual real world), pull out Google Maps, and realise that my actual, not-simulator iPhone is using a simulated location. In this instance my iPhone is stuck thinking that it's in London (where I live), but right central in Picadilly Circus, not where I am.
I get home, open up Xcode, and to make sure I've nailed down the cause (rather than just a weird GPS bug etc), change the 'default location' to Johannesburg. Unplug my phone, open Google Maps (and Foursquare, to be sure), same deal. Stuck in Johannesburg.
So it's definitely this panel here that's borked my phone, but I can't figure out how to reset it.
Things I've tried that don't seem to work:
changing 'default location' to 'none' & rerunning
disabling 'allow location simulation' & rerunning
So it seems once you've given your iPhone an arbitrary location to pretend to be in, just disabling that doesn't fix it.
Any ideas? I'm going travelling in a few days and really need my GPS to work!
While you have your device connected to the debugger there is a little button at the top of the debug panel. Right here:
Click on that and you can select 'don't simulate location', exit the app, and I think you'll be good to go.
I'm a little foggy too on how that relates to the location defined in the scheme and the location set in the simulator. I usually find it easier to set a location in the simulator itself rather than in the scheme (at least when testing in the simulator is possible) to avoid issues like this. In the simulator if you enter a location under 'Debug > Location > Custom Location...' while the simulator is on the springboard the location will persist between launches of the app and the simulator.
This has happened to me before, it was very strange and mysterious!
I don't remember how I fixed it, but: have you tried Reset Location & Privacy in the Settings app? If all else fails, I suspect Reset All Settings would maybe work.
As I try to remember, I think maybe hard rebooting the phone might also work (just turn it off, turn it back on).
just Reset Location & Privacy . turnoff location service . restart your phone .. turn on location service . try using google maps .. it work for me ..
The important step is the hard reset after resetting location settings. Not sure if you need to do anything in Xcode, but it is a good idea to select 'Don't simulate location'
Go back to Xcode (or whatever coding software you are using) and rerun the application, then select don't simulate location.
Goto Settings>Privacy>Location Services. Turn-Off Location Services. Restart the phone. Open Google maps. A popup will come to enable location service, click on the options given that will take you directly to Settings. If popup didn't appear in Google Maps, click on Mylocation button at the bottom. Enable Location services and get back to Google Maps. It re-enabled the real Location for me.
Go to Edit Scheme..., then select Run in left panel. In options, set Default Location under Core Location to None.
As suggested in this comment if you don't have Xcode handy, you can just power cycle the iPhone and this seems to be sufficient. You don't need to reset any settings. This worked this morning for my iPhone anyway, recalling it from a winter sojourn of Berlin.

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