user155
user155

Reputation: 805

Is there Camera Device Simulation in iOS Simulators?

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?

Upvotes: 16

Views: 21994

Answers (2)

Maxim Kholyavkin
Maxim Kholyavkin

Reputation: 4573

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...

Upvotes: 2

Hassan Shahbazi
Hassan Shahbazi

Reputation: 1603

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

Upvotes: 24

Related Questions