React Native 0.63.3在Ventura+Xcode14.3.1中iOS架构配置及调试报错解决
无需升级的配置修复方案
一、解决Build Settings无法选择架构的问题
- 打开Xcode项目的
Build Settings面板,搜索Architectures - 点击选项右侧的
+,选择Add User-Defined Setting,命名为ARCHS - 切换到Debug配置,将
ARCHS的值设为arm64(若需兼容旧设备可设为arm64 armv7,针对iPhone14仅需arm64) - 若找不到
Valid Architectures选项,同样添加用户自定义设置VALID_ARCHS,Debug配置下值设为arm64
二、修复CustomProductController的arm64链接错误
这个错误源于Xcode 14+与旧版Swift/RN的兼容性差异,以下是分步修复方案:
方案1:调整Swift版本与部署目标
- 在
Build Settings中搜索Swift Language Version,设置为Swift 5.0(匹配RN 0.63兼容的Swift版本) - 搜索
iOS Deployment Target,确保值为iOS 11.0及以上(Xcode 14最低支持iOS 11,RN 0.63兼容该版本)
方案2:添加Swift标准库链接参数
- 进入
Build Settings的Other Linker Flags(Debug配置),添加以下参数:-lswiftCore -lswiftFoundation - 若仍未解决,尝试添加强制加载Pods配置的参数(替换
YourProjectName为你的项目名称):-force_load "$(SRCROOT)/Pods/Target Support Files/Pods-YourProjectName/Pods-YourProjectName.debug.xcconfig"
方案3:关闭Debug模式的Bitcode
- 在
Build Settings中搜索Enable Bitcode,Debug配置下设置为No(旧版RN与Xcode 14的Bitcode兼容性较差)
方案4:调整Podfile配置并重新安装
- 打开项目根目录的
Podfile,在末尾添加以下配置:post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["ARCHS"] = "arm64" config.build_settings["VALID_ARCHS"] = "arm64" config.build_settings["ENABLE_BITCODE"] = "NO" end end end - 执行终端命令
pod install更新配置
内容的提问来源于stack exchange,提问作者Vineeta
相关产品推荐
相关产品推荐

