[英]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:更新到 Xcode 12 后,项目在模拟器上构建时给了我这个错误:
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.该框架与 cocoapods 一起安装。 It works with Xcode 11. Building on "Any iOS Device" or real iPhone with Xcode 12 also works just fine.它适用于 Xcode 11。在“任何 iOS 设备”或带有 Xcode 12 的真实 iPhone 上构建也可以正常工作。 What's different in Xcode 12? 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
".我通过确保构建设置VALID_ARCHS
(现在出现在 Xcode 12 中构建设置的底部)包含“ x86_64
”来解决这个问题。
That is:那是:
VALID_ARCHS = arm64, arm64e
在我之前: VALID_ARCHS = arm64, arm64e
VALID_ARCHS = arm64, arm64e, x86_64
修复后: 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:) (有点违反直觉,因为错误消息说它找不到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.当您修改项目以适应新的 M1 Mac,然后尝试在 Intel Mac 上运行相同的项目时,可能会出现这种情况。
It basically tries to run on the ARM architecture and finds X86_64 instead.它基本上尝试在 ARM 架构上运行并找到 X86_64。
To resolve the problem you just need to restrict the build operation to the active (X86_64) architecture only.要解决此问题,您只需将构建操作限制为仅活动 (X86_64) 架构。
You can do this by setting Build Active Architectures only to YES.您可以通过将 Build Active Architectures only 设置为 YES 来实现。
For M1 Chip Based Mac Follow the instructions below..对于基于 M1 芯片的 Mac,请按照以下说明操作。
Applications > Xcode > Get Info> checked "Open using Rosetta"应用程序 > Xcode > 获取信息 > 选中“使用 Rosetta 打开”
Thats's it and you are good to go.就是这样,你很高兴。
Tested in Xcode 13.3.1, Apple M1 Pro在 Xcode 13.3.1、Apple M1 Pro 中测试
Got this error on our app for library and this solved my problem:在我们的库应用程序上出现此错误,这解决了我的问题:
close XCode关闭 XCode
open Finder app and show there "Applications"打开 Finder 应用程序并在那里显示“应用程序”
right click on icon Xcode and click on "Get info" (or something similar)右键单击图标 Xcode,然后单击“获取信息”(或类似的东西)
there is checkbox "Open with Rosseta" (or something similar).有复选框“用罗塞塔打开”(或类似的东西)。 Select it选择它
run Xcode again and try to build再次运行 Xcode 并尝试构建
https://developer.apple.com/forums/thread/123614?login=true 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.在最新版本的 Xcode(Xcode 13.2)中, VALID_ARCHS
选项不再可用。 So i made the decision to switch the test device from a simulator to a physical device, in Xcode.所以我决定在 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/的步骤操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.