swiftcompiler-errorsruntime-errorxcode11.6

Objective-C runtime differs in PCH file and SwiftShims errors in macOS Catalina 10.15.6, Xcode 11.6, Mac Catalyst app


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'

These are repeated across all the Swift files in the build and prevent the app from running as a Mac Catalyst app.


Solution

  • 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):

    enter image description here

    To this (i.e. a number higher or lower) than iOS 13.5:

    enter image description here

    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.