Flutter开发iOS问题记录

一、版本适配问题

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'Protobuf' from project 'Pods')

可以通过在podfile中配置解决。

yaml 复制代码
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
      target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
    end
  end
end

二、Build问题

Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')

可以通过修改build settings设置解决。

三、启动图问题

Flutter启动iOS使用LaunchScreen.storyboard时布局错乱显示出两张不同的启动图,如果使用拖线布局可能会产生此问题;

Flutter在启动时会加载一次闪屏,默认显示与Info.plist中对应的UILaunchStoryboardName。

使用LaunchScreen.storyboard时避免使用Safe Area Layout Guides,Flutter可能会不识别。

四、真机调试问题

在iOS 14+系统真机以调试模式运行App,在断开调试后App无法打开;

原因是Debug模式下,Flutter也实现了热重载,默认编译方式为JIT,而iOS 14+系统对这种编译模式做了限制,导致无法启动;

可以通过更改Xcode编译模式:Xcode使用Release模式编译,这个时候Flutter编译方式为AOT,可正常启动。

不更改Xcode编译模式,更改Flutter编译配置,强制设置为release也可。

相关推荐
AGoodrMe9 小时前
swift基础之async/await
前端·ios
hhb_6189 小时前
Swift核心技术难点与实战案例解析
开发语言·ios·swift
人月神话-Lee10 小时前
【图像处理】饱和度——颜色的浓淡与灰度化
图像处理·人工智能·ios·ai编程·swift
leazer14 小时前
Flutter Windows 构建失败:.plugin_symlinks 符号链接异常的排查与修复
windows·flutter
人月神话-Lee14 小时前
【图像处理】卷积原理与卷积核——图像处理的核心引擎
图像处理·深度学习·ios·ai编程·swift
2501_9151063215 小时前
深入解析无源码iOS加固原理与方案,保护应用安全
android·安全·ios·小程序·uni-app·cocoa·iphone
Daniel_Coder17 小时前
iOS Widget 开发-15:Widget 性能优化指南
ios·swift·widget·widgetcenter
磊 子19 小时前
C++ IO 流
macos·objective-c·cocoa
库奇噜啦呼19 小时前
【iOS】源码学习-dyld加载
学习·ios·cocoa
Daniel_Coder19 小时前
iOS Widget 开发-16:Widget 网络数据加载策略
ios·swift·widget·widgetcenter