Since the update to macOS Mojave, I get this alert every time I run on the simulator:
\"
\" would like to access the microphone.
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.