Flutter应用归档至App Store失败:FMDB.framework文件缺失报错
Flutter应用归档至App Store失败(Xcode 14.3)
问题详情
Flutter应用可正常运行,但使用最新版Xcode 14.3(14E222b)归档发布至App Store时失败,Flutter已更新至最新版本。
已执行的排查操作
已尝试以下命令:
flutter upgrade flutter clean flutter pub get cd ios pod deintegrate rm -f Podfile.lock pod install pod update pod install sudo gem install cocoapods sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc
同时完成了这些操作:
- 在Xcode中删除DerivedData、清理构建文件夹
- 将Pod > FMDB > General > Minimum Deployment设置为12.0
报错信息
归档启动约30秒后出现如下错误:
PhaseScriptExecution [CP] Embed Pods Frameworks /Users/mateo/Library/Developer/Xcode/DerivedData/Runner-dehetosspbhbthhgdgvjmdurocom/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-B1164030238D389C328552D1.sh (in target 'Runner' from project 'Runner') cd /Users/mateo/Documents/Dev/App-VE-app/ios /bin/sh -c /Users/mateo/Library/Developer/Xcode/DerivedData/Runner-dehetosspbhbthhgdgvjmdurocom/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-B1164030238D389C328552D1.sh mkdir -p /Users/mateo/Library/Developer/Xcode/DerivedData/Runner-dehetosspbhbthhgdgvjmdurocom/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks Symlinked... rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/FMDB.framework" "/Users/mateo/Library/Developer/Xcode/DerivedData/Runner-dehetosspbhbthhgdgvjmdurocom/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks" building file list ... rsync: link_stat "/Users/mateo/Documents/Dev/App-VE-app/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/FMDB.framework" failed: No such file or directory (2) done sent 29 bytes received 20 bytes 98.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9] Command PhaseScriptExecution failed with a nonzero exit code
解决方案
1. 统一部署目标版本
在ios目录下的Podfile顶部添加或修改部署版本,确保与项目设置一致:
platform :ios, '12.0'
然后执行:
cd ios pod deintegrate rm Podfile.lock pod install
2. 调整Xcode构建设置
- 打开Xcode,选中Runner目标,进入
Build Settings - 搜索
VALID_ARCHS,添加arm64(若未存在) - 搜索
BUILD_LIBRARY_FOR_DISTRIBUTION,设置为YES
3. 使用Flutter命令行归档
跳过Xcode直接通过Flutter命令生成归档包:
flutter build ipa --release
执行完成后会自动打开归档目录,直接在Xcode中打开对应的归档文件即可验证。
4. 指定FMDB稳定版本
若FMDB依赖存在兼容性问题,可在Podfile中锁定稳定版本:
pod 'FMDB', '~> 2.7.5'
之后重新执行pod install。
内容的提问来源于stack exchange,提问作者Matancy
相关产品推荐
相关产品推荐

