Trying to access camera hardware using
let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: AVMediaType.video, position: AVCaptureDevice.Position.front)
guard let captureDevice = deviceDiscoverySession.devices.first else {
print("Failed to get the camera device")
}
In many devices I get the Failed to get camera device error.
Devices like
- iPhone XS
- iPhone X
- iPhone 7
- iPhone 11
- iPhone 11 Pro Max
- iPhone 8
- iPhone14,7
- iPhone 12
- iPhone XR
- iPhone SE (2nd generation)
- iPhone 13
- iPhone 13 Pro
- iPhone 6s
- iPhone 6s Plus
Is there a reason why this might happen if the hardware is functioning properly. Please help as a lot of users are facing this issue.