Xcode 12 issue - Could not find module 'FrameworkName' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64

Viewed 18862

After updating to Xcode 12 the project gives me this error when building on simulator:

Could not find module 'FrameworkName' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64

The framework is installed with cocoapods. It works with Xcode 11. Building on "Any iOS Device" or real iPhone with Xcode 12 also works just fine. What's different in Xcode 12?

9 Answers

I fixed this by ensuring the build setting VALID_ARCHS (now appearing at the bottom of Build Settings in Xcode 12) contains "x86_64".

That is:

  • Before I had: VALID_ARCHS = arm64, arm64e
  • After fixing: VALID_ARCHS = arm64, arm64e, x86_64

(A little counterintuitive, as the error message says it couldn't find the module for arm64-apple-ios-simulator, :shrug:)

This situation presumably arises when you modify your project to suit the new M1 Macs, and then try to run the same project on an Intel Mac.

It basically tries to run on the ARM architecture and finds X86_64 instead.

To resolve the problem you just need to restrict the build operation to the active (X86_64) architecture only.

You can do this by setting Build Active Architectures only to YES.

enter image description here

I solved this by excluding arm64 in both app Target and test Target for Debug like the below pictures.

Tested and worked on Xcode 13.

enter image description here

enter image description here

Got this error on our app for library and this solved my problem:

close XCode

open Finder app and show there "Applications"

right click on icon Xcode and click on "Get info" (or something similar)

there is checkbox "Open with Rosseta" (or something similar). Select it

run Xcode again and try to build

https://developer.apple.com/forums/thread/123614?login=true

You can try to set $(ARCHS_STANDARD) for VALID_ARCHS for Debug for Any iOS Simulator SDK and set YES for ONLY_ACTIVE_ARCH for Debug. It worked for me.

enter image description here

For M1 Chip Based Mac Follow the instructions below..

Applications > Xcode > Get Info> checked "Open using Rosetta"

Thats's it and you are good to go.

Tested in Xcode 13.3.1, Apple M1 Pro

Current Working Solution

  post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
    end
  end

In the newest version of Xcode, (Xcode 13.2) the option for VALID_ARCHS is no longer available. So i made the decision to switch the test device from a simulator to a physical device, in Xcode. I did not have the issue when running on a physical test device

Related