简体   繁体   English

Xcode 12 问题 - 找不到目标“arm64-apple-ios-simulator”的模块“FrameworkName”; 找到:x86_64-apple-ios-simulator,x86_64

[英]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:那是:

  • Before I had: VALID_ARCHS = arm64, arm64e在我之前: VALID_ARCHS = arm64, arm64e
  • After fixing: 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:)

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.您可以尝试将$(ARCHS_STANDARD)设置为VALID_ARCHS以进行任何 iOS 模拟器 SDK 的调试, ONLY_ACTIVE_ARCH设置为YES以进行调试。 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.当您修改项目以适应新的 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 来实现。

在此处输入图片说明

I solved this by excluding arm64 in both app Target and test Target for Debug like the below pictures.我通过在 app Target 和 test Target for Debug 中排除 arm64 解决了这个问题,如下图所示。

Tested and worked on Xcode 13.在 Xcode 13 上测试和工作。

在此处输入图片说明

在此处输入图片说明

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.

相关问题 找不到目标“arm64-apple-ios-simulator”的模块“Alamofire”; 找到:x86_64-apple-ios-simulator,x86_64 - could not find module 'Alamofire' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64 找不到目标“x86_64-apple-ios-simulator”的模块“FBSDKCoreKit”; 找到:arm64,arm64-apple-ios-simulator - Could not find module 'FBSDKCoreKit' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator 找不到目标“x86_64-apple-ios-simulator”的模块“XXXX”; 在 Swift 项目中找到:arm64、arm64-apple-ios-simulator? - Could not find module 'XXXX' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator in Swift Project? 找不到目标“x86_64-apple-ios-simulator”的模块“MyCustomFramework”; 找到:arm64、armv7-apple-ios、arm64-apple-ios、arm、armv7 - Could not find module 'MyCustomFramework' for target 'x86_64-apple-ios-simulator'; found: arm64, armv7-apple-ios, arm64-apple-ios, arm, armv7 找不到目标“x86_64-apple-ios-simulator”的模块“Kingfisher” - Could not find module 'Kingfisher' for target 'x86_64-apple-ios-simulator' 找不到目标“x86_64-apple-ios-simulator”的模块 - Could not find module for target 'x86_64-apple-ios-simulator' 找不到目标“x86_64-apple-ios-simulator”的模块“Alamofire” - could not find module 'Alamofire' for target 'x86_64-apple-ios-simulator' 目标 'arm64-apple-ios' 的 iOS 'Heimdall' 出现错误; 找到:x86_64“ - Getting Error in iOS 'Heimdall' for target 'arm64-apple-ios'; found: x86_64 " Xcode 12,为 iOS 模拟器构建,但链接为 iOS 构建的目标文件,用于架构 x86_64 - Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture x86_64 在 XCode 12 中找不到 x86_64 的符号 - 仅模拟器 - Getting symbol not found for x86_64 in XCode 12 - only Simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM