【问题标题】:How to fix SWIFT_VERSION error on PhoneGap Build如何修复 PhoneGap Build 上的 SWIFT_VERSION 错误
【发布时间】:2020-08-06 03:39:04
【问题描述】:

我正在开发一个 cordova 应用程序,并使用 PhoneGap 构建为 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 上一切正常。我真的需要这个插件,而且我的时间不多了。如果有人对我如何解决此问题或其他插件有任何建议,我将不胜感激。

注意:我目前没有在我的代码中使用这个插件,因为我无法让它编译,所以我没有代码可以显示

【问题讨论】:

    标签: ios cordova plugins filechooser


    【解决方案1】:

    我在 Ionic 项目中使用 Cordova,并按以下方式设置 swift 版本。我希望这对你也有帮助。

    默认情况下,添加了对 Swift 4 的支持,但仍可以将旧版本 (2.3) 配置为首选项,在项目的 config.xml 中,在 <platform name="ios"> 部分中:

    <preference name="UseLegacySwiftLanguageVersion" value="true" />
    

    或者可以在项目的config.xml 中的&lt;platform name="ios"&gt; 部分中指定如下版本:

    <preference name="UseSwiftLanguageVersion" value="5" />
    

    您的插件正在使用此 swift 依赖项,您可以查看此链接以获取更多信息:https://www.npmjs.com/package/cordova-plugin-add-swift-support

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-04
      • 2019-10-20
      • 1970-01-01
      • 1970-01-01
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多