Xcode 12打包React Native应用时AccessibilityResources.bundle多重生成报错求助
iOS应用归档构建编译问题记录
核心报错信息
构建归档阶段触发重复产物生成错误,两个独立的构建Target同时配置了同一路径的bundle创建输出命令,具体冲突路径为Xcode中间产物目录下的AccessibilityResources.bundle,涉及冲突Target如下:
React-Core-60309c9c-AccessibilityResourcesReact-Core-AccessibilityResources
完整报错日志:
Multiple commands produce '/Users/sumantakundu/Library/Developer/Xcode/DerivedData/Globallove-emwwobuvdzgwhtbdhclymguzjmkg/Build/Intermediates.noindex/ArchiveIntermediates/Globallove/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle': 1) Target 'React-Core-60309c9c-AccessibilityResources' has create directory command with output '/Users/sumantakundu/Library/Developer/Xcode/DerivedData/Globallove-emwwobuvdzgwhtbdhclymguzjmkg/Build/Intermediates.noindex/ArchiveIntermediates/Globallove/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle' 2) Target 'React-Core-AccessibilityResources' has create directory command with output '/Users/sumantakundu/Library/Developer/Xcode/DerivedData/Globallove-emwwobuvdzgwhtbdhclymguzjmkg/Build/Intermediates.noindex/ArchiveIntermediates/Globallove/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
已通过StackOverflow、通用搜索引擎检索同类问题,现有公开解决方案对应的冲突场景与本次报错的Target名称不匹配,无法直接定位问题根源。
项目依赖版本
项目核心依赖版本清单:
{ "@react-native-async-storage/async-storage": "^1.14.1", "@react-native-community/masked-view": "^0.1.10", "@react-native-cookies/cookies": "^6.0.4", "@react-navigation/drawer": "^5.12.3", "@react-navigation/native": "^5.9.2", "@react-navigation/stack": "^5.14.2", "react": "16.13.1", "react-native": "0.63.4", "react-native-gesture-handler": "^1.9.0", "react-native-image-slider-box": "^1.0.12", "react-native-ionicons": "^4.6.5", "react-native-paper": "^3.6.0", "react-native-reanimated": "^1.13.2", "react-native-safe-area-context": "^3.1.9", "react-native-screens": "^2.17.1", "react-native-tableview-simple": "^4.2.1", "react-native-vector-icons": "^8.0.0", "react-native-webview": "^11.2.1", "rn-webview": "^0.1.0" }
工程配置信息
Xcode构建设置
已附Xcode构建设置界面截图作为排查参考。
Podfile配置
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' platform :ios, '10.0' target 'Globallove' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) # 测试Target配置已注释 #target 'GloballoveTests' do #inherit! :complete # Pods for testing #end # Flipper调试功能配置 # 若开启use_frameworks!,Flipper将无法正常工作,需注释以下配置 use_flipper!({ 'Flipper' => '0.74.0' }) post_install do |installer| flipper_post_install(installer) installer.pods_project.targets.each do |target| if target.name == "React-Core.common-AccessibilityResources" target.remove_from_project end end end end
问题修复步骤
- 调整Podfile中post_install的Target过滤规则:现有配置仅匹配
React-Core.common-AccessibilityResources名称的Target,与实际报错的两个冲突Target名称不匹配,规则未生效。需将逻辑修改为匹配所有名称包含AccessibilityResources的React-Core相关Target,仅保留一份有效Target即可。 - 清理构建缓存:删除iOS目录下的Pods文件夹、Podfile.lock文件;清空Xcode DerivedData目录;重新执行
pod install安装依赖;在Xcode中选择「Product > Clean Build Folder」选项后重新执行归档构建。
内容的提问来源于stack exchange,提问作者sumanta.k
相关产品推荐
相关产品推荐

