Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[camera] Fixes crash when taking a picture on iOS devices without flash #3411

Merged
merged 4 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.0+5

* Fixes crash when taking a picture on iOS devices without flash.

## 0.7.0+4

* Make sure the configured zoom scale is copied over to the final capture builder on Android. Fixes the issue where the preview is zoomed but the final picture is not.
Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera/ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ - (instancetype)initWithCameraName:(NSString *)cameraName
_enableAudio = enableAudio;
_dispatchQueue = dispatchQueue;
_captureSession = [[AVCaptureSession alloc] init];
_flashMode = FlashModeAuto;
_captureDevice = [AVCaptureDevice deviceWithUniqueID:cameraName];
_flashMode = _captureDevice.hasFlash ? FlashModeAuto : FlashModeOff;
_exposureMode = ExposureModeAuto;
_focusMode = FocusModeAuto;
_lockedCaptureOrientation = UIDeviceOrientationUnknown;

_captureDevice = [AVCaptureDevice deviceWithUniqueID:cameraName];
NSError *localError = nil;
_captureVideoInput = [AVCaptureDeviceInput deviceInputWithDevice:_captureDevice
error:&localError];
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera
description: A Flutter plugin for getting information about and controlling the
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
and streaming image buffers to dart.
version: 0.7.0+4
version: 0.7.0+5
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera

dependencies:
Expand Down