cordova-plugins-qrscanner 无法为 ios 构建

cordova-plugins-qrscanner failed to build for ios

我有一个 PhoneGap 应用程序,我正在使用插件 cordova-plugin-qrscanner

我的 config.xml 文件包括:

<plugin name="cordova-plugin-qrscanner" source="npm" spec="~3.0.1" />

我正在使用 PhoneGap 云构建构建应用程序 (https://build.phonegap.com)

在 Android 上构建成功,应用程序正常运行

在 iOS 我收到一个错误

Check dependencies
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

** ARCHIVE FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
Error: xcodebuild: Command failed with exit code 65
    at ChildProcess.whenDone (/private/project/cordova/node_modules/cordova-common/src/superspawn.js:135:23)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

我已经尝试添加 swift 支持插件

<plugin name="cordova-plugin-add-swift-support" source="npm" spec="~2.0.2" />

并注明swift版本如下

<preference name="swift-version" value="3.0" />
<preference name="UseSwiftLanguageVersion" value="3" />

但是,运气不好,我无法让它工作

有什么建议吗?

我找到了解决办法 我在这里发帖给任何有相同经历的人

添加插件

<plugin name="cordova-plugin-qrscanner" source="npm" spec="~3.0.1" />

我将 swift 版本更改为 4.2

<preference name="UseSwiftLanguageVersion" value="4" />
<preference name="SwiftVersion" value="4.2" />

我使用这条线添加了 swift-support 钩子

<hook type="after_platform_add" src="plugins/cordova-plugin-qrscanner/scripts/swift-support.js" />

最后一个修复在 iOS 'QRScanner.swift' 中(路径:src/ios/QRScanner.swift)

在 openSettings 函数中将 "string: UIApplication.openSettingsURLString" 更改为 "string: UIApplicationOpenSettingsURLString"。第 470 行