如何在模拟器上测试 iOS 麦克风的使用情况?
如何在 IO 模拟器中测试麦克风?我不认为它是通过 Mac 屏幕顶部的内置音频进行录制的,这一点我是理解的。
这些选项中哪一个有效?
1. 将真正的麦克风插入我的笔记本电脑
2. 将应用程序导出到我的 Iphone <- 我还不知道如何执行此操作
3. 下载一些将在我的 MacBook 屏幕上使用内置音频的库 <- I几个月前看过一个 YouTube 视频,但现在找不到了。
我很感激任何反馈。我现在问这个是为了避免编写我无法测试的代码字符串。
谢谢你
-塞缪尔
How do I test the microphone in my IOs simulator? I don't think it records through the built in audio at the top of my Mac screen, which I understand.
Which of these options would work?
1.Plug a real microphone into my laptop
2.Export the app into my Iphone <- I don't know how to do this yet
3.Download some library that will use the built in audio on my macbook screen <- I saw a youtube video about this months ago but I can't find it now.
I appreciate any feedback. I'm asking this now to avoid programming strings of code that I cannot test.
Thank you
-Samuel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
内置麦克风应与 iOS 模拟器配合使用。
The built in microphones should work with the iOS Simulator.
从 iOS 8.2 开始,我认为麦克风无法工作。以下是 Apple 文档中的链接,说明了这一事实:
https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/iOS_Simulator_Guide/TestingontheiOSSimulator/TestingontheiOSSimulator.html
查看硬件限制部分。
I don't think microphone works as of iOS 8.2. Here is link from Apple documentation that state this fact:
https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/iOS_Simulator_Guide/TestingontheiOSSimulator/TestingontheiOSSimulator.html
Look at the Hardware limitations section.
模拟器将自动使用 Mac 的内置麦克风
AVAudioRecorder
来录制麦克风中的音频。如果您使用模拟器,这将自动使用 Mac 的内置麦克风,因此您可以在设备上或模拟器中进行测试。如果您使用的是没有麦克风输入的 Mac mini?
请记住,有一个巧妙的技巧可以从 iPhone/iPad 录制音频。您需要连接 Lightning 电缆或 USB-C 电缆,并在实用程序/音频设备设置中启用硬件设备:
单击启用:

这个新的音频输入将在您的模拟器中可见!因此,现在即使您的 Mac 没有麦克风,您也可以在模拟器中进行录制。
我相信它已经永远可用,而且我刚刚验证过,它适用于 Mac mini 2018 和 macOS Catalina 10.15.4 以及 Xcode 版本 11.4.1。
这足以解决您的 iOS 应用程序的问题,但有一个小警告。默认情况下,您会从 iOS 设备中取出线路,这样我就可以播放音乐,而我的 Mac 也会收到它。到目前为止,一切都很好。
然而,要正确访问麦克风,您需要第三方应用程序来桥接并使麦克风可供迷你使用,但这对于仅对模拟器上的麦克风进行故障排除来说并不是必需的。我希望我自己解释了。
The simulator this will automatically use your Mac's built-in microphone
AVAudioRecorder
will record audio from the microphone. If you're using the simulator this will automatically use your Mac's built-in microphone, so you can test either on device or in the simulator.And if you are on a Mac mini without a microphone input?
Remember that there is a neat trick to record audio from your iPhone/iPad. You need a lightning cable or USB-C cable connected and enable your hardware device in the Utilities/Audio Devices settings:
Click on enable:

This new audio input will be visible in your emulator! So now you can record in simulator even if your Mac hasn't got a microphone
It has been available forever I believe and I just verified, it works for the Mac mini 2018 and macOS Catalina 10.15.4 and Xcode Version 11.4.1.
It will be enough to trouble shoot your iOS apps, but there is a small caveat. By default you get the line out from your iOS device, so I could play music and my mac would receive it. So far so good.
However to properly access the mic you would need a third party app to bridge and make the mic available to the mini but this is not necessary to just troubleshoot the mic on the simulator. I hope I explained myself.