xcode 如何在模拟器上测试 iOS 麦克风的使用情况?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9152355/
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
How do I test iOS microphone use on the simulator?
提问by Samuel W Anderson
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.
如何在我的 IO 模拟器中测试麦克风?我不认为它是通过 Mac 屏幕顶部的内置音频录制的,我理解这一点。
Which of these options would work?
这些选项中的哪一个会起作用?
1.Plug a real microphone into my laptop
1.将真正的麦克风插入我的笔记本电脑
2.Export the app into my Iphone <- I don't know how to do this yet
2.将应用程序导出到我的 Iphone <- 我还不知道该怎么做
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.
3.下载一些将在我的 macbook 屏幕上使用内置音频的库 <- 我几个月前看过一个关于这个的 youtube 视频,但现在找不到了。
I appreciate any feedback. I'm asking this now to avoid programming strings of code that I cannot test.
我感谢任何反馈。我现在要求这样做是为了避免编写我无法测试的代码字符串。
Thank you
谢谢
-Samuel
-塞缪尔
采纳答案by nicoz_88
The built in microphones should work with the iOS Simulator.
内置麦克风应与 iOS 模拟器配合使用。
回答by sarabdeep singh
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
我不认为麦克风从 iOS 8.2 开始工作。这是 Apple 文档中说明这一事实的链接:https: //developer.apple.com/library/ios/documentation/IDEs/Conceptual/iOS_Simulator_Guide/TestingontheiOSSimulator/TestingontheiOSSimulator.html
Look at the Hardware limitations section.
查看硬件限制部分。
回答by multitudes
The simulator this will automatically use your Mac's built-in microphone
这个模拟器会自动使用你 Mac 的内置麦克风
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.
AVAudioRecorder
将从麦克风录制音频。如果您使用模拟器,这将自动使用 Mac 的内置麦克风,因此您可以在设备上或模拟器中进行测试。
And if you are on a Mac mini without a microphone input?
如果您使用的是没有麦克风输入的 Mac mini?
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:
请记住,从 iPhone/iPad 录制音频有一个巧妙的技巧。您需要连接闪电电缆或 USB-C 电缆并在实用程序/音频设备设置中启用您的硬件设备:
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
这个新的音频输入将在您的模拟器中可见!所以现在你可以在模拟器中录音,即使你的 Mac 没有麦克风
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.
我相信它一直可用,我刚刚验证,它适用于 Mac mini 2018 和 macOS Catalina 10.15.4 和 Xcode 版本 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.
这足以解决你的 iOS 应用程序的问题,但有一个小警告。默认情况下,您会从 iOS 设备中获取线路,这样我就可以播放音乐,而我的 mac 会收到它。到现在为止还挺好。
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.
但是,要正确访问麦克风,您需要第三方应用程序来桥接麦克风并使麦克风可用于 mini,但这并不是仅对模拟器上的麦克风进行故障排除所必需的。我希望我解释了自己。