cordova-plugin-qrscanner
cordova-plugin-qrscanner copied to clipboard
Failed to compile in iOS
I thought this was resolved by now based on all the other posts from last year. But it looks like its still an ongoing issue.
The following build commands failed:
CompileSwift normal armv7 /Users/macknife/dev/myApp/platforms/ios/myApp/Plugins/cordova-plugin-qrscanner/QRScanner.swift
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
CompileSwift normal arm64 /Users/macknife/dev/myApp/platforms/ios/myApp/Plugins/cordova-plugin-qrscanner/QRScanner.swift
I tried adding the <preference name="UseSwiftLanguageVersion" value="5" /> to my config.xml file but the errors are still there.
I am reading that I need change: UIApplication.openSettingsURLString to UIApplicationOpenSettingsURLString - but where do I make this change?
well, turns out the same posts last year are still the fix here:
In the following file: myApp/platforms/ios/myApp/Plugins/cordova-plugin-qrscanner/QRScanner.swift
Update lines 471 and 484 - by replacing UIApplication.openSettingsURLString to UIApplicationOpenSettingsURLString`
Why isn't this update merged into the master? Until it is, ppl better update the original plugin in the project in case you have to platform remove/add ios otherwise you will have to update the above file manually every time.
Please merge this into master, it's been almost a year.
@rolinger @98teg @piwpio @iChristosK @Catscratch We've forked the repo and upgraded it to modern versions. Check https://github.com/nosoloforks/cordova-plugin-qrscanner (v4.0.0 is not published on NPM)
Maybe it helps to link @matiu directly here. I had the same issue just now
i met this error either. i try to fix it without forking a clone to change the source code.
as @rolinger said, the error occurred because the Swift API changed.
well, turns out the same posts last year are still the fix here:
In the following file: myApp/platforms/ios/myApp/Plugins/cordova-plugin-qrscanner/QRScanner.swift
Update lines 471 and 484 - by replacing
UIApplication.openSettingsURLString toUIApplicationOpenSettingsURLString`
we can change the cordova swift version to < 4.2, errors fixed
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<!-- you may update platform ios using `cordova platform rm ios` & `cordova platform add ios` -->
<preference name="UseSwiftLanguageVersion" value="4" />
</platform>