美文网首页
ios xcode15.0.1 flutter1.22.6卡启

ios xcode15.0.1 flutter1.22.6卡启

作者: 惊蛰_e3ce | 来源:发表于2023-11-21 15:02 被阅读0次

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


截屏2023-11-22 14.56.22.png

包含了解决方法

-ld_classic 和"-ld64"是一个意思
截屏2023-11-22 14.33.49.png

脚本还用

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed_and_thin

相关文章

网友评论

      本文标题:ios xcode15.0.1 flutter1.22.6卡启

      本文链接:https://www.haomeiwen.com/subject/xmwbwdtx.html