When opening the barcode scanner (camera), the app crashes immediately on devices running iOS 16 and iOS 17.
The same devices work fine after updating to iOS 18.
Affected devices
| Device |
iOS Version |
Result |
| iPhone 8 Pro Max |
16.7.14 |
Crash |
| iPhone SE (Gen 2/3) |
17.5.1 |
Crash |
| iPhone 13 |
17.2.1 |
Crash |
All devices work correctly after updating to the latest iOS 18.
Possible cause
After reviewing the OSBarcodeLib-iOS source code, I noticed the library uses several APIs that were deprecated in iOS 17:
AVCaptureVideoOrientation and videoPreviewLayer.connection?.videoOrientation — deprecated in iOS 17.0 in favor of AVCaptureDevice.RotationCoordinator
UIWindowScene.windows (in UIApplication+Window.swift) — deprecated in iOS 15.0 in favor of UIWindowScene.keyWindow
onChange(of:perform:) — deprecated in iOS 17.0
These deprecated APIs may behave unpredictably on iOS 16–17, while iOS 18 likely improved backward compatibility.
Environment
@capacitor/barcode-scanner: 3.0.2
OSBarcodeLib: 2.0.1 (pinned in podspec)
@capacitor/ios: 8.1.0
@capacitor/core: 8.1.0
- Minimum deployment target: iOS 15.0
When opening the barcode scanner (camera), the app crashes immediately on devices running iOS 16 and iOS 17.
The same devices work fine after updating to iOS 18.
Affected devices
All devices work correctly after updating to the latest iOS 18.
Possible cause
After reviewing the
OSBarcodeLib-iOSsource code, I noticed the library uses several APIs that were deprecated in iOS 17:AVCaptureVideoOrientationandvideoPreviewLayer.connection?.videoOrientation— deprecated in iOS 17.0 in favor ofAVCaptureDevice.RotationCoordinatorUIWindowScene.windows(inUIApplication+Window.swift) — deprecated in iOS 15.0 in favor ofUIWindowScene.keyWindowonChange(of:perform:)— deprecated in iOS 17.0These deprecated APIs may behave unpredictably on iOS 16–17, while iOS 18 likely improved backward compatibility.
Environment
@capacitor/barcode-scanner: 3.0.2OSBarcodeLib: 2.0.1 (pinned in podspec)@capacitor/ios: 8.1.0@capacitor/core: 8.1.0