Building iOS Simulator can't link library built for iOS

Hi there, I have an app that builds and runs on iOS devices, and also builds and runs in "My Mac (Designed for iPad)" with my m2 mac. But im having issues building it to run in the xcode iOS simulator.

We want to build on the simulator so we can test issues that only affect users with previous versions of ios that we dont have on any of our test devices. And we cant downgrade them so sim is our best option.

I'm getting this linker error:

building for 'iOS-simulator', but linking in object file built for 'iOS'

The library it's complaining about we can't rebuild since we dont have the source code. We know that it was built with arm64 and it works with an actual iOS device, AND on m2 mac for ipad.

Perhaps this is naiive but why doesnt this just work with the iOS simulator? The arch is the same, it works on a real device, but not the simulator. Is there anything we can do to get it working on the simulator without recompiling the library?

Things we've already tried:

  • Using Excluded Architecture x86_64 to make sure we're only building for the arm64 simulator
  • Reading Technote 3117 this didnt help since our architectures already match.

Other threads with the same or similar issue:

https://developer.apple.com/forums/thread/744276

https://developer.apple.com/forums/thread/716586

why doesnt this just work with the iOS simulator? The arch is the same, it works on a real device, but not the simulator.

The architecture information is not enough. Binaries for Apple platforms contain platform-specific metadata, and that includes differences between the simulator and device builds as well. Aside for the potential of the compiled code to be slightly different, this is how the linker is able to ensure that a binary is complied for the right build destination and platform, and not just has the right architecture.

Using Excluded Architecture x86_64 to make sure we're only building for the arm64 simulator

That's the reverse of what you want. Take another read through TN3117 to review those details, and also make sure you're heeding the advice that you're only using the Excluded Architecture setting as a temporary mitigation, and that's not a replacement for making sure you get a library that is properly updated to run on the iOS simulator with an Apple silicon Mac.

— Ed Ford,  DTS Engineer

Building iOS Simulator can't link library built for iOS
 
 
Q