react-native-vision-camera: ๐Ÿ› When taking a photo the capture fails with error `-11800: The operation could not be completed`

Whatโ€™s happening?

Please watch the video below.

https://github.com/mrousavy/react-native-vision-camera/assets/54767632/13da3839-c112-45dc-ae5e-d751797b3bd8

https://github.com/mrousavy/react-native-vision-camera/assets/54767632/1621cc18-65ea-4c56-9abd-9ffc7d498786

========================================================================================

The error only occurs under completely specific conditions.

In my opinion, this condition is when using IOS17 or higher on iPhone 14

The error did not occur when using IOS16 on iPhone 14.

I canโ€™t confirm that itโ€™s a bug in IOS17. Because when using IOS17 on other devices such as SE, 12, etc., the bug does not occur.

I want to know what the problem is.

The build took place in xcode14.2.

Reproduceable Code

const device = useCameraDevice('back');

try { 
    if (tempPath === '') {
         setIsActive(false);
         const photo =
             Platform.OS === 'ios'
                 ? await cameraRef.current.takePhoto({
                      flash: 'off',
                     })
                 : await cameraRef.current.takeSnapshot({
                      quality: 80,
                      flash: 'off',
                    });
                
        let rotatedUri = photo.path;

        await foodLensProcess(rotatedUri);
    }  else {
           setTempPath('');
           setFoodInfo(null);
           setUploadPath('');
           setIsActive(true);
    }
} catch (err) {
    alert(err);
    console.log('takePhoto catch :', err);
}

<Camera
    ref={cameraRef}
    style={StyleSheet.absoluteFill} 
    device={device}
    isActive={isActive}
    photo={true}
/>

Relevant log output

Error Domain=AVFoundationErrorDomain Code=-11800 The operation could not be completed UserInfo={NSUnderlyingError=0x28006b360 { Error Domain=NSOSStatusErrorDomain Code=-16800 "(null)"}, NSLocalizedFailureReason=Anunknown error occurred (-16800), AVErrorRecordingFailureDomainKey=4, NSLocalizedDescription=The operation could not be completed}

Camera Device

-

Device

iPhone 14 Pro(IOS 17.0.2, 17.0.3)

VisionCamera Version

3.3.1

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

I have this problem too, iOS 17.1.1 in a native app (swiftui). In my case it works sometimes. So it looks like some kind of timing error. I seem to solve the problem by setting photoSettings.photoQualityPrioritization = .speed // instead of .quality

Not sure that setting is accessible here, but just trying to solve the same problem sort of.