I have the following code:
NSArray * devices = [ AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo ];
// 2. Iterate through the device array and if a device is a camera, check if it's the one we want:
for ( AVCaptureDevice * device in devices )
{
    if ( useFrontCamera && AVCaptureDevicePositionFront == [ device position ] )
    {
        // We asked for the front camera and got the front camera, now keep a pointer to it:
        m_camera = device;
    }
    else if ( !useFrontCamera && AVCaptureDevicePositionBack == [ device position ] )
    {
        // We asked for the back camera and here it is:
        m_camera = device;
    }
}
the warning says that devicesWithMediaType is deprecated and I should use AVCaptureDeviceDiscoverySession instead, I have tried the following:
AVCaptureDeviceDiscoverySession *captureDeviceDiscoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera] 
                                      mediaType:AVMediaTypeVideo 
                                       position:AVCaptureDevicePositionBack];
NSArray *captureDevices = [captureDeviceDiscoverySession devices];
but the array of devices has only my back camera and not my front cam, any help?