Skip to content

Commit

Permalink
BarcodeScanner crashes app in iOS 9.3 / iPad 2 #69
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jan 5, 2017
1 parent 55956c1 commit 1cd5d02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions barcodescanner.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ var BarcodeScanner = (function () {
});
self._scanner.delegate = delegate_1;
var device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);
device.lockForConfiguration();
device.autoFocusRangeRestriction = 1;
device.unlockForConfiguration();
if (device.autoFocusRangeRestrictionSupported) {
device.lockForConfiguration();
device.autoFocusRangeRestriction = 1;
device.unlockForConfiguration();
}
var topMostFrame = frame.topmost();
if (topMostFrame) {
var vc = topMostFrame.currentPage && topMostFrame.currentPage.ios;
Expand Down
8 changes: 5 additions & 3 deletions barcodescanner.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ export class BarcodeScanner {

// restrict scanning range for better speed: https://github.com/EddyVerbruggen/nativescript-barcodescanner/issues/48
let device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);
device.lockForConfiguration();
device.autoFocusRangeRestriction = AVCaptureAutoFocusRangeRestriction.Near;
device.unlockForConfiguration();
if (device.autoFocusRangeRestrictionSupported) {
device.lockForConfiguration();
device.autoFocusRangeRestriction = AVCaptureAutoFocusRangeRestriction.Near;
device.unlockForConfiguration();
}

let topMostFrame = frame.topmost();
if (topMostFrame) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-barcodescanner",
"version": "2.3.2",
"version": "2.3.3",
"description": "Scan QR/barcodes with a {N} app.",
"main": "barcodescanner",
"nativescript": {
Expand Down

0 comments on commit 1cd5d02

Please sign in to comment.