简体   繁体   中英

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

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?

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

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.

在此处输入图片说明

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.

在此处输入图片说明

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.

在此处输入图片说明

在此处输入图片说明

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

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

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 an the issue when running on a test device

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

您可以尝试删除应用程序的派生数据,然后清理并构建应用程序,您可以按照以下链接https://programmingwithswift.com/delete-derived-data-xcode/的步骤操作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM