iOS 模拟器中是否有相机设备模拟?

Is there Camera Device Simulation in iOS Simulators?

Android 模拟器可以模拟摄像头设备(见截图) 例如我可以测试我的视频录制模块是如何工作的:

iOS-模拟器呢?当我尝试 运行 我的使用相机的应用程序时,出现下一个错误

Thread 5: Fatal error: Unexpectedly found nil while unwrapping an Optional value

let videoDeviceInput = try AVCaptureDeviceInput(device: defaultVideoDevice!)

所以没有可用于 iOS-模拟器的模拟设备?

根据Apple documentation,不支持在模拟器中使用相机:

The following hardware is not supported in Simulator:

  • Ambient light sensor

  • Audio input, except for using Siri by choosing Hardware > Siri.

  • Barometer

  • Bluetooth

  • Camera

  • Motion support (accelerometer and gyroscope)

  • Proximity sensor

有一种已知的解决方法有时可能会有用:https://github.com/YuigaWada/iCimulator

但它不适用于像 WebRTC 这样的第 3 方库...