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
4 changes: 3 additions & 1 deletion LBXScan/LBXNative/LBXScanNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ - (void)stopScan
- (void)setTorch:(BOOL)torch {

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

Expand Down
10 changes: 6 additions & 4 deletions LBXScan/LBXZXing/LBXZXCapture.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ - (void)setMirror:(BOOL)mirror {
}

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

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

- (void)changeTorch
Expand Down