Я получил странную ошибку для AVCaptureDevice, которая происходит только на iPhone6. Я попробовал его на iPhone6S и iPad, и он отлично работает. Ошибка: Домен = AVFoundationErrorDomain Код = -11814
Здесь выводится сообщение об ошибке:
Unable to obtain video device input, error: Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Record" UserInfo={NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again.}
Вот фрагмент кода. В videoDevices нет возврата, поэтому он пропускает это. Обычно его можно получить, но не для iPhone6.
//get the front camera
NSArray *videoDevices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in videoDevices)
{
if (device.position == AVCaptureDevicePositionFront) {
_videoDevice = device;
break;
}
}
// obtain device input
NSError *error = nil;
AVCaptureDeviceInput *videoDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:_videoDevice error:&error];
if (!videoDeviceInput)
{
NSLog(@"%@", [NSString stringWithFormat:@"Unable to obtain video device input, error: %@", error]); <--- the print out message is from here.
return;
}
Как я могу решить эту проблему, это происходит только на iPhone6. Его обновили до последней версии 12.4.6.