如何修复 PhoneGap Build 上的 SWIFT_VERSION 错误
How to fix SWIFT_VERSION error on PhoneGap Build
我正在开发一个 cordova 应用程序并使用 PhoneGap build 为 iOS 编译。我已将 <plugin name="cordova-plugin-simple-file-chooser" />
添加到我的应用程序,但由于某种原因,它导致 PhoneGap 构建失败,我收到此错误
The “Swift Language Version” (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. T) 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.
如果我删除插件,构建就会成功。我在网上搜索了一下,发现了很多类似的场景,但大多数涉及使用 Xcode,而不是 PhoneGap 构建。我没有 Mac,所以我不确定如何解决这个问题。在 Android 上一切正常。我真的需要这个插件而且我 运行 没时间了。如果有人对我如何解决这个问题或其他插件有任何建议,我将不胜感激。
注意:我目前没有在我的代码中使用这个插件,因为我无法编译它,所以我没有代码可以展示
我在我的 Ionic 项目中使用 Cordova,并按以下方式设置 swift 版本。希望对你也有帮助。
默认情况下,添加了 Swift 4 支持,但仍然可以在项目 config.xml
的 <platform name="ios">
部分中将旧版本 (2.3) 配置为首选项:
<preference name="UseLegacySwiftLanguageVersion" value="true" />
或者可以在项目 config.xml
的 <platform name="ios">
部分中按如下方式指定版本:
<preference name="UseSwiftLanguageVersion" value="5" />
您的插件正在使用此 swift 依赖项,您可以查看此 link 以获取更多信息:https://www.npmjs.com/package/cordova-plugin-add-swift-support
我正在开发一个 cordova 应用程序并使用 PhoneGap build 为 iOS 编译。我已将 <plugin name="cordova-plugin-simple-file-chooser" />
添加到我的应用程序,但由于某种原因,它导致 PhoneGap 构建失败,我收到此错误
The “Swift Language Version” (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. T) 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.
如果我删除插件,构建就会成功。我在网上搜索了一下,发现了很多类似的场景,但大多数涉及使用 Xcode,而不是 PhoneGap 构建。我没有 Mac,所以我不确定如何解决这个问题。在 Android 上一切正常。我真的需要这个插件而且我 运行 没时间了。如果有人对我如何解决这个问题或其他插件有任何建议,我将不胜感激。
注意:我目前没有在我的代码中使用这个插件,因为我无法编译它,所以我没有代码可以展示
我在我的 Ionic 项目中使用 Cordova,并按以下方式设置 swift 版本。希望对你也有帮助。
默认情况下,添加了 Swift 4 支持,但仍然可以在项目 config.xml
的 <platform name="ios">
部分中将旧版本 (2.3) 配置为首选项:
<preference name="UseLegacySwiftLanguageVersion" value="true" />
或者可以在项目 config.xml
的 <platform name="ios">
部分中按如下方式指定版本:
<preference name="UseSwiftLanguageVersion" value="5" />
您的插件正在使用此 swift 依赖项,您可以查看此 link 以获取更多信息:https://www.npmjs.com/package/cordova-plugin-add-swift-support