You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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目标的构建设置:

  1. 打开Xcode的Pods项目,找到Lottie目标进入Build Settings
  2. 搜索COMBINE_HIDPI_IMAGES,设置为YES
  3. 对React-Core或React目标重复上述操作,确保bundle被识别为纯资源包,避免自动注入可执行文件相关键值

方案3:修正bundle的文件类型标记

  1. 打开Pods项目,找到对应目标的Resources Build Phase
  2. 选中报错的bundle文件,在右侧File Inspector中设置File Type为Bundle
  3. 确认Target Membership仅勾选对应的Pod目标,避免主项目重复处理导致配置冲突

内容的提问来源于stack exchange,提问作者femmedecentral

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 02:43:16