问题描述
我正在尝试为iOS模拟器在具有M1架构的Mac Book Pro上构建React Native项目.
I'm trying to build a React Native project on a Mac Book Pro with a M1 architecture, for iOS simulator.
该项目很好地建立在Intel架构上.
The project built nicely on Intel architecture.
它也可以在设备上构建,并可以在M1上很好地存档.但是不在模拟器上.
It also build on device and archive well on M1. But not on simulator.
切换到M1芯片组时,我遇到了经典错误.
I had this classical error when switching to the M1 chipset.
我将arm64添加到排除的体系结构中.
I added arm64 to excluded architectures.
我还添加了以下代码段,但是如果没有它,它的反应也相同.
I also added the following snippet but it also react the same way without it.
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
现在我有
我试图将x86_64添加到项目的体系结构列表中,但没有结果.
I tried to add x86_64 on the list of architectures of the project, with no results.
我正在从XCode GUI构建.对于我尝试过的所有iPhone:8、11、12和我尝试过的所有目标,都会出现此错误消息:iOS 9、10和13.
I'm building from XCode GUI. This error message appears for all iPhones I tried: 8, 11, 12 and all targets I tried: iOS 9, 10 and 13.
推荐答案
我遇到了同样的问题,最后,我对其进行了修复.错误的主要原因有两个
I had the same issue and finally, I fix it.there are 2 main reasons for errors
- arm64体系结构支持&许多流行的第三方库(如Firebase,AFNetworking等)尚未提供与Xcode 12兼容的版本. Xcode 11过去曾自动将用于仿真器的arm64的构建转换为用于x86_64的构建,但是现在arm64是有效的仿真器体系结构(它是Apple Silicon体系结构),因此不再发生这种翻译.
2.由于在Xcode 12中删除了有效体系结构"构建设置,因此在Xcode 12中打开的Project文件将在User-Defines中自动生成VALID_ARCHS宏,并且此宏将使构建失败.
2.Because the Valid Architectures build setting being removed in Xcode 12, So Project file open in Xcode 12 will auto-generate a VALID_ARCHS macro in User-Defines, and this macro will make the build failed.
我按照这篇文章中的所有步骤进行操作. https://medium. com/@ khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9
I follow all steps in this post. https://medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9
最后一步是通过在ios文件夹中运行以下命令来更新所有Pod:
final step was updating all pods by running below command inside ios folder :
pod解体
pod更新
然后,从您的主项目和Pod项目中排除用于模拟器体系结构的arm64.在此处输入图片描述
then I exclude arm64 for simulator architecture both from your main Project and the Pod project.enter image description here
清理项目(shift + command + k)然后运行
clean project (shift +command +k) then run
这篇关于Apple Silicon M1上的React Native-链接库'libPods-ProjectName.a'缺少此目标所需的一个或多个架构:x86_64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!