51

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?

Mojave security alert!

Cœur
  • 37,241
  • 25
  • 195
  • 267
Udi Levy
  • 611
  • 1
  • 6
  • 7

8 Answers8

26

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.

Internal Microphone

Roger Perez
  • 2,807
  • 29
  • 31
11

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

medvedNick
  • 4,512
  • 4
  • 32
  • 50
  • and what does give you? it still asks you all the time even if microphone is unchecked there for xcode – user25 Mar 08 '19 at 16:56
6

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.

russbishop
  • 16,587
  • 7
  • 61
  • 74
  • Is there a way to dismiss the prompt when running automated UI tests? My tests pass on my local machine after I've manually dismissed the prompt once, but they fail when using a CI service where they run in a fresh container every time. – Steven Vandeweghe Mar 14 '19 at 10:25
  • See radar 48882952 :-) – Steven Vandeweghe Mar 14 '19 at 10:57
  • Xcode 12 still has this bug, just... different. First time run simulator (with xcode) opens mic. If I close the simulator and run it again with xcode it no longer accesses the mic. creepy if you ask me. – thedp Feb 22 '21 at 22:40
2

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)

Peter Suwara
  • 781
  • 10
  • 16
1
  1. Go to "Security & Privacy" Settings on macOS

  2. Select "Microphone" on the left panel

  3. On the right panel disable the option for Xcode

Shantanu Madane
  • 617
  • 5
  • 14
1

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.

creednmd
  • 2,001
  • 2
  • 18
  • 25
0

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
andriy_fedin
  • 175
  • 2
  • 9
-2

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

Mani
  • 101
  • 10
  • Yes, I thought of this section, But Xcode not showing there for me. Why? – Udi Levy Nov 27 '18 at 08:56
  • Please check under system preferences not of Xcode. – Mani Nov 29 '18 at 04:46
  • simply click on "Don't Allow" on simulator – Mani Dec 03 '18 at 20:17
  • 2
    @Mani Too bad it asks every single time I run the app every single day. It's annoying. Putting Don't Allow doesn't do anything besides remove the popup until next build. It always asks the first time a sound plays in the app. – Hedylove Dec 05 '18 at 07:01
  • I have updated my solution to new one currently working for me. Please try this one – Mani Dec 07 '18 at 21:54