iOS模拟器中有相机设备模拟吗?

发布于 2025-01-13 03:01:39 字数 495 浏览 2 评论 0原文

Android模拟器可以模拟Camera设备(见截图) 例如,我可以测试我的视频录制模块的工作原理:

Android 模拟器,相机模拟示例

iOS 模拟器怎么样?当我尝试运行使用相机的应用程序时,我收到下一个错误,

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

因此

let videoDeviceInput = try AVCaptureDeviceInput(device: defaultVideoDevice!)

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

Android emulators can simulate Camera device (see screenshot)
For example I can test how my video recording module works:

Android Emulator, camera simulation example

What about iOS-Simulators? When I try to run my app which uses camera I get the next error

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

at line

let videoDeviceInput = try AVCaptureDeviceInput(device: defaultVideoDevice!)

so no simulated devices are available for iOS-Simulators?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幽蝶幻影 2025-01-20 03:01:39

根据 Apple 文档,不支持将相机与模拟器一起使用:

模拟器不支持以下硬件:

  • 环境光传感器

  • 音频输入,除了通过选择硬件 > 使用 Siri 之外Siri。

  • 晴雨表

  • 蓝牙

  • 相机

  • 运动支持(加速计和陀螺仪)

  • 接近传感器

According to Apple documentation, using camera with Simulator is not supported:

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

つ可否回来 2025-01-20 03:01:39

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

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

There is one known workaround which could be useful sometimes: https://github.com/YuigaWada/iCimulator

But it does not work with 3-rd party libs like WebRTC though...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文