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

iOS can't compile on Xcode 10+ Swift 4.2/4 #263

Open BobSadan opened 4 years ago

BobSadan commented 4 years ago

Hi, It appears some errors about qrscanner.swift from Xcode 10+ when I achieve app, it maybe version swift4 or swift 4.2 to case the failed achieve app, Doesn't support ios swift 4 or 4.2 using this plugin? Please someone could help me! Thank you

ir2pid commented 4 years ago

I get it too, here is the error

cordova-plugin-qrscanner/QRScanner.swift:471:63: error: 'openSettingsURLString' has been renamed to 'UIApplicationOpenSettingsURLString'
            guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
                                                              ^~~~~~~~~~~~~~~~~~~~~
                                                              UIApplicationOpenSettingsURLString
DerkJanSpeelman commented 4 years ago

Changing UIApplication.openSettingsURLString to UIApplicationOpenSettingsURLString will fix your error.

Change it in /platforms/ios/AppName/Plugings/cordova-plugin-qrscanner/QRScanner.swift on line 471 and line 484.

Also, I needed to replace it in/cordova/plugins/cordova-plugin-qrscanner/src/ios, also on line 471 and line 484.

ImpacGroup commented 4 years ago

I've also had this issue. Changing the swift version of the project to 5 worked for me. Try https://www.npmjs.com/package/cordova-plugin-add-swift-support

chrsi commented 4 years ago

I've added the plugin and put <preference name="UseSwiftLanguageVersion" value="5" /> into the ios section of my config.xml

The line did get copied to the config.xml inside the ios platform folder ... so it should be configured correctly. Unfortunatelly the error message remains the same. The setting somehow seems to be ignored.

thameurr commented 4 years ago

Same problem of @chrsi , Error in Xcode :

testBarcode[41952:3157079] Error is [object Object]
Message from debugger: Terminated due to signal 15

Any Help

malua commented 4 years ago

I could fix it this way:

In Xcode go to Build Settings -> "Swift Compiler - Lanuage" -> "Swift Lanuage Version" Set it to at least 4.2, then it works.

I am using Cordova 9 and cordova-ios 5.0.1

michellecolin commented 4 years ago

I've added the plugin and put <preference name="UseSwiftLanguageVersion" value="5" /> into the ios section of my config.xml

The line did get copied to the config.xml inside the ios platform folder ... so it should be configured correctly. Unfortunatelly the error message remains the same. The setting somehow seems to be ignored.

The right way to write the preference is:

<preference name="SwiftVersion" value="5" />`

otherwise it was not working for me. If you are using Cordova 9, try that :)