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

标签 ios ionic-framework ionic4

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

ionic cordova build 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 build设置中切换 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 构建的能力。

关于ios - 由于 swift 版本 3,ionic 4 ios 无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55381659/

相关文章:

angular - 为什么 Ionic Framework 插件 healthkit 出现错误 plugin_not_installed?

angular - 如何为订阅内的变量赋值?

angular-material - 当我尝试在 ionic 中打开带有 Angular Material 的 BottomSheet 时,this.bottomSheet.open 不是一个函数

ios - Swift 中奇怪的断点异常是怎么回事?

ios - 无论图像大小如何,获取 UIButtons 的标签以排列

html - 在 ionic 框架中使用复选框时如何从 ionic 标签中删除空间

cordova - 类似 Instagram 的强制触摸弹出模式

angular - 如何使用异步等待来防止在 array.length 对象上获取 0?

ios - plist writeToFile 覆盖整个plist

ios - 如何在 UIDatePicker 中设置最大日期?