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

Failed to compile in iOS

Open rolinger opened this issue 5 years ago • 6 comments

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?

rolinger avatar Apr 15 '20 22:04 rolinger

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`

rolinger avatar Apr 15 '20 23:04 rolinger

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.

rolinger avatar Apr 15 '20 23:04 rolinger

Please merge this into master, it's been almost a year.

pedroadame avatar Jan 28 '21 09:01 pedroadame

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

pedroadame avatar Feb 24 '21 13:02 pedroadame

Maybe it helps to link @matiu directly here. I had the same issue just now

graphefruit avatar Mar 25 '21 12:03 graphefruit

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 to UIApplicationOpenSettingsURLString`

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>

TinyChou avatar Aug 08 '21 04:08 TinyChou