使用Transporter上传IPA遇CFBundleIdentifier冲突错误的解决咨询
解决Transporter上传IPA时的CFBundleIdentifier冲突(90685错误)
问题本质
flutter build ipa会自动重新生成Xcode项目配置,你手动在Xcode里修改的「Pods_Runner.framework不嵌入」和「删除Embed Pods Frameworks步骤」会被覆盖,必须用自动化脚本在构建流程中固化这些修改。
最可靠方案:修改iOS Podfile添加自动处理逻辑
直接在Flutter项目的ios/Podfile中添加post_install脚本,每次执行pod install(包括Flutter触发的)都会自动应用正确配置:
- 打开项目下的
ios/Podfile - 在文件末尾的
post_install块中补充以下代码(如果原来没有post_install块,直接新增):
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) # 1. 配置Pods-Runner目标,禁用Swift库自动嵌入 if target.name == 'Pods-Runner' target.build_configurations.each do |config| config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO' end end # 2. 移除Runner目标中重复的Embed Pods Frameworks构建阶段 installer.pods_project.targets.each do |runner_target| next unless runner_target.name == 'Runner' runner_target.build_phases.each do |phase| phase.remove_from_project if phase.display_name == 'Embed Pods Frameworks' end end # 3. 将Pods_Runner.framework设置为「不嵌入」 installer.pods_project.targets.each do |runner_target| next unless runner_target.name == 'Runner' runner_target.frameworks_build_phase.files.each do |file| if file.file_ref.name == 'Pods_Runner.framework' file.settings = { 'ATTRIBUTES' => ['RemoveHeadersOnCopy'] } end end end end end
- 保存Podfile后,在iOS目录下执行
pod install,或者直接运行flutter build ipa即可生效。
验证方法
执行flutter build ipa生成IPA后,打开Xcode检查Runner项目:
- 「通用」标签→「框架、库和嵌入内容」中,Pods_Runner.framework应为「不嵌入」
- 「构建阶段」标签中,不会出现Embed Pods Frameworks步骤
此时再用Transporter上传,90685错误应该消失。
备选方案:Flutter构建前钩子脚本
如果Podfile修改没生效,可以用Flutter的构建钩子在build前自动修改Xcode配置:
- 在项目根目录创建
scripts/pre_build.sh文件,写入:
#!/bin/bash cd ios # 设置Pods_Runner.framework不嵌入 xcodebuild -project Runner.xcodeproj -target Runner -configuration Release \ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO # 删除重复的Embed Pods Frameworks构建阶段 PHASE_INDEX=$(grep -n 'Embed Pods Frameworks' Runner.xcodeproj/project.pbxproj | head -n1 | cut -d: -f1) if [ ! -z "$PHASE_INDEX" ]; then /usr/libexec/PlistBuddy -c "Delete :buildPhases:$((PHASE_INDEX-1))" Runner.xcodeproj/project.pbxproj fi
- 给脚本加执行权限:
chmod +x scripts/pre_build.sh - 在
pubspec.yaml中添加钩子配置:
flutter: # 其他配置不变 hooks: pre-build: - bash scripts/pre_build.sh
内容的提问来源于stack exchange,提问作者Jordan Castro
相关产品推荐
相关产品推荐

