我有一个 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/