React Native应用上传TestFlight遇Unexpected CFBundleExecutable Key错误求助
解决React Native归档TestFlight时的Unexpected CFBundleExecutable Key错误
方案1:通过Podfile脚本自动清理错误键值
这类错误的根源是依赖库的bundle资源被错误注入了CFBundleExecutable键,直接修改本地临时文件不会影响归档构建,需要在Pod安装阶段自动修正。
在你的Podfile末尾添加以下脚本:
post_install do |installer| installer.pods_project.targets.each do |target| # 处理LottiePrivacyInfo.bundle if target.name == 'Lottie' target.resources_build_phase.files.each do |file| if file.file_path.end_with?('LottiePrivacyInfo.bundle/Info.plist') plist_path = file.file_path system("plutil -remove CFBundleExecutable '#{plist_path}'") end end end # 处理AccessibilityResources.bundle if target.name == 'React-Core' || target.name == 'React' target.resources_build_phase.files.each do |file| if file.file_path.end_with?('AccessibilityResources.bundle/Info.plist') plist_path = file.file_path system("plutil -remove CFBundleExecutable '#{plist_path}'") end end end end end
执行pod install后重新归档,脚本会自动找到对应bundle的Info.plist并移除错误键值,确保归档构建使用修正后的配置。
方案2:调整依赖库的构建配置
如果方案1无效,可直接修改Pod目标的构建设置:
- 打开Xcode的Pods项目,找到
Lottie目标进入Build Settings - 搜索
COMBINE_HIDPI_IMAGES,设置为YES - 对
React-Core或React目标重复上述操作,确保bundle被识别为纯资源包,避免自动注入可执行文件相关键值
方案3:修正bundle的文件类型标记
- 打开Pods项目,找到对应目标的Resources Build Phase
- 选中报错的bundle文件,在右侧File Inspector中设置
File Type为Bundle - 确认
Target Membership仅勾选对应的Pod目标,避免主项目重复处理导致配置冲突
内容的提问来源于stack exchange,提问作者femmedecentral
相关产品推荐
相关产品推荐

