iOS Simulator would like to access microphone every time

后端 未结 8 840
忘掉有多难
忘掉有多难 2020-12-24 04:55

Since the update to macOS Mojave, I get this alert every time I run on the simulator:

\"\" would like to access the microphone.

相关标签:
8条回答
  • 2020-12-24 05:35
    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

    0 讨论(0)
  • 2020-12-24 05:39

    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.

    0 讨论(0)
  • 2020-12-24 05:40

    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)

    0 讨论(0)
  • 2020-12-24 05:41

    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

    0 讨论(0)
  • 2020-12-24 05:47

    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.

    0 讨论(0)
  • 2020-12-24 05:48

    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.

    0 讨论(0)
提交回复
热议问题