ios xcode15.0.1 flutter1.22.6 卡启动屏 打包体积变小 安装启动闪退
一直用的flutter1.22.6 随着xcode15 ios17更新
一遍再开新工程跑flutter3.16,一遍还在维护老项目
升级xcode15后,跑老工程发现出问题跑不起来,
按网上说的修改了podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
flutter_additional_ios_build_settings(target)
end
end
post_integrate do |installer|
compiler_flags_key = 'COMPILER_FLAGS'
project_path = 'Pods/Pods.xcodeproj'
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
target.build_phases.each do |build_phase|
if build_phase.is_a?(Xcodeproj::Project::Object::PBXSourcesBuildPhase)
build_phase.files.each do |file|
if !file.settings.nil? && file.settings.key?(compiler_flags_key)
compiler_flags = file.settings[compiler_flags_key]
file.settings[compiler_flags_key] = compiler_flags.gsub(/-DOS_OBJECT_USE_OBJC=0\s*/, '')
end
end
end
end
end
project.save()
end
修改了 other link flags
-ld_classic
报
Runner.app/Info.plist does not exist. The Flutter "Thin Binary" build phase must run after "Copy Bundle Resources".
查了后将脚本
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed_and_thin
修改为
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
确实能跑起来了,但是会卡在启动屏,flutter侧得main方法没有执行到,
能打包,但是打包出来的包体积大小不对,安装后启动闪退,怀疑还是资源问题
联想到这句报错
Runner.app/Info.plist does not exist. The Flutter "Thin Binary" build phase must run after "Copy Bundle Resources".
在1.22.6和3.16.0新建demo后发现demo工程中Thin的脚本并没有被修改,但是能够正常运行,排查方向切换到脚本上
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
在flutter的git issues下关键词 xcode15 Thin Binary 搜索到
点开第一个 关键词 Thin
包含了解决方法
-ld_classic 和"-ld64"是一个意思
脚本还用
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed_and_thin