当前位置:网站首页>XCODE12 在使用模拟器(SIMULATOR)时编译错误的解决方法
XCODE12 在使用模拟器(SIMULATOR)时编译错误的解决方法
2022-08-05 08:45:00 【今人不见古时月,今月曾经照古人】
Xcode12 上使用模拟器编译项目时,出现错误。同样的代码在Xcode11则不会有问题。Xcode12 在使用模拟器(Simulator)时编译错误的解决方法
一些错误如下:
No such modules (import installed pods)
Cocoapods post-build step with the script they install issue -> Pods/Target Support Files/Pods-All-Apps-XXX/Pods-All-Apps-XXX-frameworks.sh: line 141: ARCHS[@]: unbound variable
‘ObjCheaderFile.h’ file not found. (ObjC Headers in bridging file)



为什么会出现这些错误?
在查阅Xcode12的升级文档,我们找到如下内容:

1、Xcode11 项目中模拟器会编译为x86_64,但Xcode12的模拟器基于苹果Apple Silicon architecture执行,需要编译为arm64运行在模拟器上。许多第三方库(如Firebase,AFNetworking等)并未提供Xcode12版本的更新支持,导致报错。
2、Xcode12 开始移除编译设置(Bulid Settings)中的 Valid Architectures的宏定义。当项目使用Xcode12打开时候,会在User-Defines(项目的Bulid Settings里面)中自动生成VALID_ARCHS宏定义。如果旧项目存在于此冲突的宏定义,会导致编译失败。
如何修复?
第一步:添加 arm64 到 simulator architecture 中。主项目和pod项目都需要。
在主项目和pod项目的PROJECT的Build Settings中,搜索Excluded Architecture ,添加 Any iOS Simulator SDK,value填入 arm64


注意:在pod项目的build setting是cocopod自动生成的,本次修改在下次更新第三方库时候会被覆盖,可以添加脚本在Podfile中,防止每次安装和更新都需要手动修改。
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
第二步:在主项目和pod项目的PROJECT的Build Settings中,删除VALID_ARCHS(整个删除,不能只删除value留下Key

本文转自他人!
原文链接:Xcode12 在使用模拟器(Simulator)时编译错误的解决方法_HDLX刘乔泓的博客-CSDN博客_simulator模拟器error030084
边栏推荐
- What is the connection and difference between software system testing and acceptance testing? Professional software testing solution recommendation
- Version number naming convention
- 浅谈自动采集程序及入库
- Why is pnpm hitting npm and yarn dimensionality reduction?
- 写出了一个CPU占用极高的代码后引发的思考
- Detailed explanation of DNS query principle
- Codeforce 8.1-8.7做题记录
- tear apart loneliness
- Thinking and summary of the efficiency of IT R&D/development process specification
- [Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
猜你喜欢

How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color

Comprehensively explain what is the essential difference between GET and POST requests?Turns out I always misunderstood

力扣刷题八月第一天

七夕看什么电影好?爬取电影评分并存入csv文件

DNS 查询原理详解

ps怎么替换颜色,自学ps软件photoshop2022,ps一张图片的一种颜色全部替换成另外一种颜色

全面讲解GET 和 POST请求的本质区别是什么?原来我一直理解错了

TensorFlow安装步骤

What is a good movie to watch on Qixi Festival?Crawl movie ratings and save to csv file

Chapter 12 Bayesian Networks
随机推荐
Luogu: P2574 XOR的艺术 [线段树]
DNS 查询原理详解
最 Cool 的 Kubernetes 网络方案 Cilium 入门教程
16种香饭做法全攻略
How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color
[Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
国际原子能机构总干事称乌克兰扎波罗热核电站安全形势堪忧
spark集群部署(第三弹)
基于多块信息提取和马氏距离的k近邻故障监测
Redis implements distributed lock-principle-detailed explanation of the problem
DPU — 功能特性 — 安全系统的硬件卸载
pnpm 是凭什么对 npm 和 yarn 降维打击的
接口全周期的生产力利器Apifox
Beautifully painted MM set
全面讲解GET 和 POST请求的本质区别是什么?原来我一直理解错了
SQL SERVER on master-slave table trigger design
Redis实现分布式锁-原理-问题详解
Adb authorization process analysis
六年团队Leader实战秘诀|程序员最重要的八种软技能 - 脸皮薄容易耽误事 - 自我营销
DataFrame insert row and column at specified position