diff --git a/ios/RCTCameraManager.m b/ios/RCTCameraManager.m index bd611f0bd..09d1043ee 100644 --- a/ios/RCTCameraManager.m +++ b/ios/RCTCameraManager.m @@ -574,8 +574,12 @@ - (void)captureStill:(NSInteger)target options:(NSDictionary *)options orientati [self saveImage:imageData target:target metadata:nil resolve:resolve reject:reject]; #else [[self.stillImageOutput connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:orientation]; - - [self.stillImageOutput captureStillImageAsynchronouslyFromConnection:[self.stillImageOutput connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) { + AVCaptureConnection *connection = [self.stillImageOutput connectionWithMediaType:AVMediaTypeVideo]; + if (!connection.enabled) { + reject(RCTErrorUnspecified, nil, RCTErrorWithMessage(@"RCTCamera: AVCaptureConnection for the image output not enabled anymore.")); + return; + } + [self.stillImageOutput captureStillImageAsynchronouslyFromConnection:connection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) { if (imageDataSampleBuffer) { NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];