问题描述
使用 Xcode 11.6 为 macOS Catalina 10.15.6 构建时,出现两个错误:
When building for macOS Catalina 10.15.6 using Xcode 11.6, two errors occur:
<unknown>:0: error: target Objective-C runtime differs in PCH file vs. current file
<unknown>:0: error: missing required module 'SwiftShims'
这些在构建中的所有 Swift 文件中重复出现,并阻止应用作为 Mac Catalyst 应用运行.
These are repeated across all the Swift files in the build and prevent the app from running as a Mac Catalyst app.
推荐答案
当你的 iOS 目标是 13.5 时会发生这种情况,在你的应用目标的 General > 中向上或向下调整它.部署信息设置将解决该问题.
This occurs when your iOS target is 13.5, adjusting it upwards or downwards in your app target's General > Deployment Info setting will resolve the issue.
从此更改(产生错误):
Change from this (which generates error):
为此(即高于或低于 iOS 13.5 的数字):
To this (i.e. a number higher or lower) than iOS 13.5:
我不知道为什么会发生这种情况,但它可靠地解决了问题,当改回 iOS 13.5 时,崩溃再次发生.
I don't know why this happens but it reliably solves the issue and when changed back to iOS 13.5 the crash happens again.
这篇关于Objective-C 运行时在 PCH 文件和 macOS Catalina 10.15.6、Xcode 11.6、Mac Catalyst 应用程序中的 SwiftShims 错误方面有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!