ios - cordova-plugins-qrscanner 无法为 ios 构建

标签 ios swift qr-code phonegap

我有一个 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-version改成了4.2

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

我使用这一行添加了 swift-support 钩子(Hook)

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

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

在 openSettings 函数中将“字符串:UIApplication.openSettingsURLString”更改为“字符串:UIApplicationOpenSettingsURLString”。第470行

关于ios - cordova-plugins-qrscanner 无法为 ios 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57714890/

相关文章:

ios - 推送套件未收到pushCredentials token

json - 如何将所有数据加载到选择器 View 中

swift - 在 web View 中加载 url 的 MacOS 问题

vba - 为 MS Access 制作 QRCode ActiveX 控件 : Control Source Property

android - ZXing 完全包括在内,但相机旋转

ios - 当 modalPresentationStyle=UIModalPresentationCustom 时不调用 viewDidAppear 和 viewDidDisappear

ios - ui 测试 xcode,如何使用 cellquery 点击表格 View 单元格按钮

ios - 使用 UIBezierPath 的 PrgressView

ios - Swift 扩展最佳实践

blackberry - 黑莓示例中的 qr 阅读器