iOS Simulator would like to access microphone every time - ios

Since the update to macOS Mojave, I get this alert every time I run on the simulator:
"<AppName>" would like to access the microphone.
It is stopping the simulator from running!
How can I stop it?

What worked for me was to change the Hardware Audio Input to Internal Microphone.
What I believe happen is that when you give access it changes the audio input to your headphones or macbook.
My concern was that I am watching a tutorial and it keeps changing the audio frequency and it kept bothering me.

My app does not use microphone, it only plays videos. I was able to fix the alert popup by restricting Microphone access for Xcode in Security & Privacy -> Microphone

This has been resolved in Xcode 10.2 Beta. Installing the beta should also fix it for older Xcode versions since CoreSimulator.framework will be upgraded (and remains backwards-compatible with older Xcodes).
The new behavior prompts for Microphone access once on your Mac. That approval (or denial) covers all processes in all Simulator runtimes including new runtimes downloaded and new Xcodes installed after the initial approval prompt.
The normal TCC rules continue to apply inside Simulator. Your app must have the relevant Info.plist keys with a microphone usage description if you actually attempt to record audio. This will continue to generate an iOS TCC prompt inside that specific Simulator. If your app only plays audio then no TCC prompts will be generated by iOS.

What fixed this for me was to Not Allow the microphone access for xcode. After selecting this option the popup no longer appeared after further restarts.
Unfortunately the previous fixes did not work as Xcode was not available in:
System Preferences -> Security & Privacy -> Privacy -> Microphone (No Xcode listed here)

Go to "Security & Privacy" Settings on macOS
Select "Microphone" on the left panel
On the right panel disable the option for Xcode

There seems to be two issues here: microphone access for both Xcode and the app itself.
Your app (or a UITest) can prompt (fail) for either or both, though not always on same run.
Both of these dialogs must be approved to allow access, after which the permission persists between Xcode and Simulator resets or restarts.
You can confirm access has been approved for Xcode in System Preferences -> Security & Privacy-> Microphone, where you should see the Xcode in the UI.
The app itself, approved or not, won't appear in the UI here, however.
If you are unsure it the app has been approved, reset all the microphone permissions with 'tccutil reset Microphone' in the Terminal, and re-run your app/test, until both dialogs have been shown and approved.

Try starting the app on the simulator not from Xcode, but from the app's icon.
The dialogue will appear one more time. Answer it and it won't appear again.

In Simulator Go to Settings -> General -> Reset -> Reset Location & Privacy and then press "Reset Warnings" when asked.

Related

iOS13 automagically remembers app permissions after deleting app [duplicate]

I'm trying to recreate the condition where the following code returns AVAuthorizationStatusNotDetermined:
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
However, the iPad appears to remember camera permissions even after the app is deleted and reinstalled, and so either Authorized or NotAuthorized is returned every time. Any idea how to reset the permissions so that NotDetermined is returned?
Thanks for reading.
You can't reset the permission programmatically. If you want to reset the permission there are two ways:
Reset the OS
Uninstall the app and wait for a day
I know both of those options are really not helpful for a developer, if they are trying to test it out something.
There are three alternatives for testing your app's first run scenario without resetting the entire OS or waiting a day.
First option
As described in Technical Note TN2265 :
You can achieve the latter without actually waiting a day by following these steps:
Delete your app from the device.
Turn the device off completely and turn it back on.
Go to Settings > General > Date & Time and set the date ahead a day or more.
Turn the device off completely again and turn it back on.
Second option
When you delete an app the iOS keeps the permission of your app mapped to your app's bundle id, it keeps the data for day. So you can also change your app's bundle id to test it out.
Third Option
As suggested by #rmaddy in the comment you can reset all location and privacy permissions : Settings -> General -> Reset -> Reset Location & Privacy.
Note that this will reset all location and privacy permissions for all the apps on that device.
This is no longer an issue if you update OS version on your device to the latest. It didnt work on 13.3.1 but it did clear permissions after 13.4.1
On iOS 14 go to Settings->Privacy->Location Services, select the app and for allow location access pick "Ask Next Time"
What worked for me:
Windows -> Devices And Simulators -> Installed Apps section
Remove the app from there using the - button.

Access is not requested again after reinstalling the app in iOS12

After updating to iOS12 and testing the apps build in Xcode 9, we found out that after deleting and reinstalling the app - the user is not prompt again with a question regarding access to the Camera or Gallery.
On iOS11, every time the app is installed, iOS asks for permission.
I tested few random apps from AppStore to see how they behave and the conclution is - some of them do reset the access and some don't. So, I'm completely lost.
Also, as an info, but I'm not 100% sure about this: when there is a time period between deleting and installing the app (more than 1h), even on iOS 12 is asking for permission.
Is there any change there in iOS 12? Do you have any clue how to keep iOS 11 behaviour instead?
Thanks!
The only certain way to test the authorization request process again after deleting your app is (and always has been) to go to the Settings app and choose General -> Reset -> Reset Location & Privacy. This is a major pain because you've now reset all your location and privacy settings.
My other suggestion (and it's only a suggestion) is that you try restarting the device after deletion of the app. Maybe, just maybe, this will cause the device to write something out to disk that will cause it to forget about its previous authorization of this app.

Show permissions dialog again in iOS

I'm working on an iOs app written in Swift with a Camera view controller. The first time I launched this view controller, the permission dialog was shown and I allowed the access to the camera and to the photo library. However, I noticed an issue while allowing the library permission and I would like to be able to reproduce it in order to fix it... But to do that, I need to re-show this permission dialog. However, even if I delete the app and reinstall it, I never get this permission dialog again.
How to get it again so I can fix my issue?
There is no perfect solution
The recommended way is go to "Settings" app
(General > Reset > Reset Location & Privacy).
But as you say, it resets all the apps.
Another option is to change the bundle identifier of the app, so it's considered a new app and it will ask again.
The third option is to delete the app, change your device time for more than 24 hours forward, turn the device off and turn it on again.
I'm not certain that it works in iOS 9, but in iOS 8 the system expired the privacy settings once the application had been uninstalled for 24 hours. You could simulate it by removing the application, moving time ahead a day in Settings and then reinstalling the application.
There's also Reset Location & Privacy, but that's a global reset.
You can go in Settings -> Privacy -> Camera and disable your app.
If you're jailbroken, you can run these shell commands on the device to reset all the permissions dialogs for just your app:
export bundleIdentifier="com.yourcompany.product"
sqlite3 /private/var/mobile/Library/TCC/TCC.db "DELETE FROM access WHERE client = '${bundleIdentifier}'"

not able to delete my ios app (completely)

I am trying to delete my app from my device. But there's some problem.
Actually am using a AvAudiorecorder, in which, when thje recording code is executed the device asks to allow/disallow the microphone(from ios OS). The problem is am doing some testing for that app. when I choose an option from them, the app doesnt prompt the allow/disallow options again , even after deleting the app from the device.
i.e. when i reinstall, the settings under microphone automatically shows his name. but which is not the case when I run on the VERY first time on device.
I read how to delete app from ios simulator and device, they are not working.
Please Help.
In your device's settings. Go to General - Reset - Reset Location & Privacy
I had the inverse problem; I had an issue in my app where the unnecessary use of AVAudioSessionCategoryPlayAndRecord was set causing unnecessary microphone usage prompting, settings, etc. My app update got rejected so I fixed the app to set only AVAudioSessionCategoryPlayback but I kept seeing the old state in settings->privacy->microphone until I followed this answer.
Interestingly, my app has been again rejected post fixing so I suspect that the app review team have not performed this important reset of the test environment.

How to test iOS 7 microphone privacy code (privacy setting cannot be removed from device) [duplicate]

I've written an app that requests access to the iPad's calendar. Under iOS 6, a system dialog appears that asks the user if that's okay.
Problem is, I can't replicate that situation once it's happened. For testing purposes, I want to force that dialog to come up consistently. Instead, the OS caches previous settings and doesn't bring up the dialog again. This is still the case even if I delete the app off the iPad and re-install. (Changing the app name and bundle fixes the problem, but I don't want to do that every time I test.)
Does anyone know how to force this to appear?
Thanks.
Settings > General > Reset > Reset Location and Privacy
You can Reset Location and Privacy as suggested by Greg Maletic but if you do not want to reset all your apps, you can just change the bundle identifier of your app.
On iOS 9 and later version,uninstall and install the app,access permission dialog will appeared.
But iOS 8 will remember what you choose.
On iOS 10.2.1:
I simply uninstall and reinstall the app again, the permission dialog appeared again.

Resources