cordova-plugin-qrscanner: 2.6.1 breaks build in Xcode 10.1
We didn’t lock the version of this plugin, so now with 2.6.1
the build is failing in Xcode 10.1.
Locking the version to 2.6.0
works, but this might still be something worth looking into.
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:483:16: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 8.0, *) {
^
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:470:9: note: enclosing scope here
if #available(iOS 10.0, *) {
^
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:38:42: error: type 'AVLayerVideoGravity' (aka 'NSString') has no member 'resizeAspectFill'
previewLayer!.videoGravity = AVLayerVideoGravity.resizeAspectFill
^~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:124:57: error: incorrect argument label in call (have 'for:', expected 'forMediaType:')
let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.video)
^~~~
forMediaType
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:136:75: error: type 'AVMediaType' (aka 'NSString') has no member 'video'
let availableVideoDevices = AVCaptureDevice.devices(for: AVMediaType.video)
^~~~~~~~~~~ ~~~~~
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:156:52: error: type 'AVMetadataObject.ObjectType' (aka 'NSString') has no member 'qr'
metaOutput!.metadataObjectTypes = [AVMetadataObject.ObjectType.qr]
^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:241:26: error: type 'AVMetadataObject.ObjectType' (aka 'NSString') has no member 'qr'
if found.type == AVMetadataObject.ObjectType.qr && found.stringValue != nil {
^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:257:57: error: incorrect argument label in call (have 'for:', expected 'forMediaType:')
let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.video)
^~~~
forMediaType
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:260:42: error: incorrect argument label in call (have 'for:completionHandler:', expected 'forMediaType:completionHandler:')
AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { (granted) -> Void in
^~~~
forMediaType
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:398:70: error: incorrect argument label in call (have 'for:', expected 'forMediaType:')
let authorizationStatus = AVCaptureDevice.authorizationStatus(for: AVMediaType.video);
^~~~
forMediaType
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:471:63: error: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
^~~~~~~~~~~~~~~~~~~~~
UIApplicationOpenSettingsURLString
UIKit.UIApplication:64:22: note: 'openSettingsURLString' was introduced in Swift 4.2
public class let openSettingsURLString: String
^
/path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift:484:74: error: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
UIApplication.shared.openURL(NSURL(string: UIApplication.openSettingsURLString)! as URL)
^~~~~~~~~~~~~~~~~~~~~
UIApplicationOpenSettingsURLString
UIKit.UIApplication:64:22: note: 'openSettingsURLString' was introduced in Swift 4.2
public class let openSettingsURLString: String
^
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64 /path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
CompileSwift normal i386 /path/to/project/platforms/ios/app/Plugins/cordova-plugin-qrscanner/QRScanner.swift
(3 failures)
xcodebuild: Command failed with exit code 65
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 3
- Comments: 28 (5 by maintainers)
I had the same problem, tried the
<preference name="UseSwiftLanguageVersion" value="5" />
and no change. I changed the “UIApplication.openSettingsURLString” to “UIApplicationOpenSettingsURLString” in QRScanner.swift and it worked.Plugin has been updated: https://www.npmjs.com/package/cordova-plugin-qrscanner
2.6.2 -> Compatible with XCode 10.1 or below
3.0.1 -> Compatible with Xcode 10.2 or higher
Thanks!
It’s work for me!
Yes, of course, but then there’s something wrong.
Build failed with the following versions: Xcode - 10.3 qrscanner - 3.0.1 Cordova - 9.0.0 (cordova-lib@9.0.1)
Fixed in config.xml using:
<preference name="SwiftVersion" value="5" />
The Error:
If you change UseSwiftLanguageVersion preference to value 5, you need to change “UIApplication.openSettingsURLString” to “UIApplicationOpenSettingsURLString” in QRScanner.swift file.
Could you maybe also update NPM? https://www.npmjs.com/package/cordova-plugin-qrscanner Still says latest version is 2.6.1.
Just for reference I got it working with:
QRScanner: 3.0.1 Cordova CLI: 8.1.1 (cordova-lib@8.1.0) Cordova Platforms: ios 5.1.1 WITH: “UIApplication.openSettingsURLString” to “UIApplicationOpenSettingsURLString” in QRScanner.swift WITHOUT:
<preference name="UseSwiftLanguageVersion" value="5" />
You might need to rm/add ios again to get to a clean slate.
@oschwier Try to add
To your
config.xml
.We have the same problem - i guess this latest release should have been a major one 🙈 Any chance this could be reverted, rereleased as 2.6.2 and a 3.0.0 with swift 5 support published?
That’s works for me, but first run
cordova platform rm ios
@cmgustavo No effect
Thanks for reporting. I think that it 's related to the non-backward compatibility between Swift 5 and 3. I will check.