Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develope #222

Open
wants to merge 13 commits into
base: develope
Choose a base branch
from
Prev Previous commit
Next Next commit
Fixed bug #167
  • Loading branch information
zhyizhou committed Aug 12, 2019
commit 5819946e204af45e9e63e8dc34a520a50dda6762
5 changes: 2 additions & 3 deletions LBXScan/LBXNative/LBXScanNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,11 @@ - (void)stopScan
}

- (void)setTorch:(BOOL)torch {

[self.input.device lockForConfiguration:nil];
if ([self.input.device hasTorch]) {
[self.input.device lockForConfiguration:nil];
self.input.device.torchMode = torch ? AVCaptureTorchModeOn : AVCaptureTorchModeOff;
[self.input.device unlockForConfiguration];
}
[self.input.device unlockForConfiguration];
}

- (void)changeTorch
Expand Down
5 changes: 2 additions & 3 deletions LBXScan/LBXZXing/LBXZXCapture.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,11 @@ - (void)setMirror:(BOOL)mirror {

- (void)setTorch:(BOOL)torch {
_torch = torch;

[self.input.device lockForConfiguration:nil];
if ([self.input.device hasTorch]) {
[self.input.device lockForConfiguration:nil];
self.input.device.torchMode = self.torch ? AVCaptureTorchModeOn : AVCaptureTorchModeOff;
[self.input.device unlockForConfiguration];
}
[self.input.device unlockForConfiguration];
}

- (void)changeTorch
Expand Down