繁体   English   中英

由于 swift 版本 3,ionic 4 ios 无法构建

[英]ionic 4 ios fails to build due to swift version 3

升级到 xcode 10.2 后,我的 ionic for ios 项目停止使用以下命令构建

离子科尔多瓦构建 ios -- --buildFlag="-UseModernBuildSystem=0"

我尝试升级cordova-ios@5.0.0并删除并读取ios平台但没有运气。

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.2'

** ARCHIVE FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

        cordova build ios --buildFlag=-UseModernBuildSystem=0 exited with exit code 65.

        Re-running this command with the --verbose flag may provide more information.

我遇到了同样的错误。 我首先尝试在 Xcode 构建设置中切换 Swift 语言版本,并很快意识到一些用 Swift 编写的插件坏了。 值得庆幸的是,对我来说破坏的插件是QR Scanner ,它维护得很好,并且已经针对 Swift 5 进行了更新。

所以我所做的修复它首先运行以下节点命令来查找和更新过时的节点包。

npm outdated
npm update

然后我确定过时/损坏的cordova插件,删除它们,然后重新安装最新版本。 使用

cordova plugin list

为确保一切都正确更新,请使用插件存储库交叉引用版本号。 然后最后我将它添加到 config.xml

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

运行时一切都成功构建,

ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"

不幸的是,如果您使用的是用 Swift 编写的 Cordova 插件并且维护得不好,那么您就不走运了。 如果你很勇敢,你可以尝试自己更新插件。

希望这会有所帮助,并且不需要您回退您的 Xcode,从而失去为最新版本的 iO 构建的能力。

您应该按照以下步骤进行-

  1. 通过单击平台 >> ios >> PROJECT_NAME.xcworkspace 中的工作区文件在 Xcode 中打开您的项目

  2. 转到构建设置

  3. 现在搜索“Swift 语言版本”

  4. 将版本更改为 4 或 5(以需要为准)

  5. 在命令下运行

    Ionic cordova build ios --buildFlag="-UseModernBuildSystem=0"

只需添加这个插件

cordova plugin add cordova-plugin-add-swift-support --save

或者,如果您已经添加,则只需删除此插件并再次添加。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM