Search code examples
iosxcodeios-simulator

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?


Solution

  • 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