Home > Mobile >  iOS simulator builds fail on M1 Mac with binary framework - "Module compiled with Swift 5.4.2 c
iOS simulator builds fail on M1 Mac with binary framework - "Module compiled with Swift 5.4.2 c

Time:12-12

Simulator builds fail in Xcode where a 3rd party framework is being used and that framework is only provided in compiled form.

Device builds are successful, but simulator builds on M1 Macs give an error:

Module compiled with Swift 5.4.2 cannot be imported by the Swift 5.5.1 compiler

CodePudding user response:

The error regarding Swift versions is misleading; as noted in the question, device builds work. It is only simulator builds that fail.

The actual cause is that the framework was built without an M1 simulator slice and so Xcode cannot complete the simulator build.

The framework supplier needs to supply an updated build that includes both x86 and M1 simulator slices.

A work-around is to get Xcode to create X86 simulator builds.

In the Build Settings for your project, specify the x86_64 architecture for iOS simulator builds:

enter image description here

  • Related