iOS Simulator would like to access microphone every time
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