cordova-plugin-qrscanner icon indicating copy to clipboard operation
cordova-plugin-qrscanner copied to clipboard

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

Open BobSadan opened this issue 6 years ago • 7 comments

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

BobSadan avatar Jun 01 '19 10:06 BobSadan

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

ir2pid avatar Jun 17 '19 16:06 ir2pid

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.

DerkJanSpeelman avatar Jun 18 '19 08:06 DerkJanSpeelman

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

ImpacGroup avatar Aug 06 '19 11:08 ImpacGroup

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.

chrsi avatar Aug 06 '19 20:08 chrsi

Same problem of @chrsi , Error in Xcode :

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

Any Help

thameurr avatar Sep 30 '19 09:09 thameurr

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

malua avatar Oct 16 '19 12:10 malua

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 :)

michellecolin avatar Dec 04 '19 20:12 michellecolin