xcode iOS模拟器每次都想访问麦克风
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53285441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iOS Simulator would like to access microphone every time
提问by Udi Levy
回答by Roger Perez
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.
对我有用的是将 Hardware Audio Input 更改为Internal Microphone。我相信会发生的是,当您授予访问权限时,它会更改耳机或 macbook 的音频输入。我担心的是我正在看一个教程,它一直在改变音频频率,它一直困扰着我。
回答by medvedNick
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
我的应用程序不使用麦克风,它只播放视频。我能够通过在安全和隐私 -> 麦克风中限制 Xcode 的麦克风访问来修复警报弹出窗口
回答by russbishop
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).
这已在 Xcode 10.2 Beta 中解决。由于 CoreSimulator.framework 将升级(并保持与旧 Xcode 的向后兼容),因此安装测试版也应该为旧的 Xcode 版本修复它。
The new behavior prompts for Microphone access onceon 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.
新行为会提示您在 Mac 上访问一次麦克风。该批准(或拒绝)涵盖所有模拟器运行时中的所有流程,包括在初始批准提示后下载的新运行时和安装的新 Xcode。
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.
正常的 TCC 规则继续适用于模拟器内部。如果您实际尝试录制音频,您的应用程序必须具有相关的 Info.plist 键和麦克风使用说明。这将继续在该特定模拟器内生成 iOS TCC 提示。如果您的应用仅播放音频,则 iOS 不会生成 TCC 提示。
回答by Peter Suwara
What fixed this for me was to Not Allowthe microphone access for xcode. After selecting this option the popup no longer appeared after further restarts.
为我解决这个问题的是不允许xcode 的麦克风访问。选择此选项后,进一步重新启动后不再出现弹出窗口。
Unfortunately the previous fixes did not work as Xcode was not available in:
不幸的是,以前的修复程序不起作用,因为 Xcode 不可用:
System Preferences -> Security & Privacy -> Privacy -> Microphone (No Xcode listed here)
系统偏好设置 -> 安全与隐私 -> 隐私 -> 麦克风(此处未列出 Xcode)
回答by Shantanu Madane
Go to "Security & Privacy" Settings on macOS
Select "Microphone" on the left panel
On the right panel disable the option for Xcode
转到 macOS 上的“安全和隐私”设置
在左侧面板上选择“麦克风”
在右侧面板上禁用 Xcode 选项
回答by creednmd
There seems to be two issues here: microphone access for both Xcode and the app itself.
这里似乎有两个问题:Xcode 和应用程序本身的麦克风访问。
Your app (or a UITest) can prompt (fail) for either or both, though not always on same run.
您的应用程序(或 UITest)可以提示(失败)其中一个或两个,但并不总是在同一运行中。
Both of these dialogs must be approved to allow access, after which the permission persists between Xcode and Simulator resets or restarts.
必须批准这两个对话框才能允许访问,之后 Xcode 和模拟器之间的权限将重置或重新启动。
You can confirm access has been approved for Xcode in System Preferences -> Security & Privacy-> Microphone, where you should see the Xcode in the UI.
您可以在 System Preferences -> Security & Privacy-> Microphone 中确认已批准 Xcode 的访问,您应该在 UI 中看到 Xcode。
The app itself, approved or not, won't appear in the UI here, however.
但是,无论是否批准,应用程序本身都不会出现在此处的 UI 中。
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.
如果您不确定该应用是否已获得批准,请在终端中使用“tccutil reset Microphone”重置所有麦克风权限,然后重新运行您的应用/测试,直到两个对话框均已显示并获得批准。
回答by andriy_fedin
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.
尝试在模拟器上启动应用程序,而不是从 Xcode,而是从应用程序的图标。对话会再出现一次。回答它,它不会再次出现。
回答by Mani
In Simulator Go to Settings -> General -> Reset -> Reset Location & Privacy and then press "Reset Warnings" when asked.
在模拟器中转到设置 -> 常规 -> 重置 -> 重置位置和隐私,然后在询问时按“重置警告”。