bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
568 stars 772 forks source link

'AVLayerVideoGravityResizeAspectFill' was obsoleted in Swift 4 #166

Closed cmartin81 closed 5 years ago

cmartin81 commented 5 years ago

I just updated to latest Cordova (8.0.0) and the latest cordova-plugin-qrscanner (2.6.0)

When I try to build the project I get the following error: AVFoundation.AVCaptureTorchMode:3:18: note: 'AVCaptureTorchMode' was obsoleted in Swift 4

Does anyone else get the same error?

bitjson commented 5 years ago

It sounds like your project is using Swift 4, while this plugin requires Swift 3. Are you using another plugin which requires Swift 4?

cmartin81 commented 5 years ago

I'm not sure, but here is a list of my plugins: Do you know a easy way to check which of these plugins are using swift 4?

cordova-custom-config 5.0.2 "cordova-custom-config" cordova-ios-export-compliance 1.0.2 "iOS Export Compliance" cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport" cordova-plugin-apprate 1.3.0 "AppRate" cordova-plugin-device 2.0.2 "Device" cordova-plugin-dialogs 1.3.4 "Notification" cordova-plugin-globalization 1.11.0 "Globalization" cordova-plugin-inappbrowser 1.7.2 "InAppBrowser" cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview" cordova-plugin-network-information 2.0.1 "Network Information" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-sqlite-storage 2.3.2 "Cordova sqlite storage plugin" cordova-support-google-services 1.1.0 "cordova-support-google-services" ionic-plugin-keyboard 2.2.1 "Keyboard" phonegap-plugin-push 2.2.3 "PushPlugin"

cmartin81 commented 5 years ago

It is actually your plugin which installs swift 4

Installing "cordova-plugin-qrscanner" for android

Android Studio project detected

Subproject Path: CordovaLib
Subproject Path: app
Installing "cordova-plugin-qrscanner" for ios

Installing "cordova-plugin-add-swift-support" for ios

Adding cordova-plugin-qrscanner to package.json

Saved plugin info for "cordova-plugin-qrscanner" to config.xml

Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to: "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h" for build configuration Debug
Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to: "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h" for build configuration Release
Update IOS build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to: YES for build configuration Debug
Use Swift language version 4
Update IOS build setting SWIFT_OPTIMIZATION_LEVEL to: -Onone for build configuration Debug
Update IOS build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to: YES for build configuration Release
Use Swift language version 4
cmartin81 commented 5 years ago

It is now working as expected. It started working after deleting the plugin and platform directory. I also had to remove the line which referred to using swift 4 in config.xml

bitjson commented 5 years ago

@cmartin81 glad you got it working! Not sure I'm following though – just to clarify, do we need to make changes to this plugin to avoid the issue? Or was it due to a setting in your project's config.xml?

danish1023 commented 5 years ago

@cmartin81 QRScanner is causing error(swift support) on pgb. I have heard something like "bridging header". Can author please change your plugin code, so that it can work on pgb also. Desperately needed that. Please. Or guide me any workaround.

dolosplus commented 5 years ago

Has anyone find a workaround for this plugin? Swift 3 is no longer supported in XCode. I only can use Swift 4 or greater and that's causing a lot of errors from Swift Compiler. For example, one of the errors stating:

/AVFoundation.AVLayerVideoGravityResizeAspectFill:3:12: 'AVLayerVideoGravityResizeAspectFill' was obsoleted in Swift 3