以下是iOS15适配问题遇到问题及解决方案小结,希望可以对大家有所帮助
1、Xcode13.0 iOS15 模拟器崩溃问题
在Xcode里选择 Product > Scheme > Edit Scheme, 然后选择 Run > Options > Queue Debugging > “Enable backtrace recording.”
2、 iOS15 flutter字体自动加粗问题
分析原因是如果在写fontStyle的时候,默认字体宽度是FontWeight.normal(w400),iOS15之后iOS展示出来的FontWeight.normal粗细几乎变成了iOS15之前的w300;
那么如何解决这个问题呢,如果是基于JDFlutter的话,无法通过设置主题来解决,可以通过每个页面的根组件外面包一层DefaultTextStyle临时解决或者直接升级sdk来解决,我们是从 1.17.5到1.22.5解决的这个问题的;如果不是的话,可以通过以下方案来解决:
一个方案是整体升级flutter sdk,另一个方案是不升级通过设置默认全局字体的fontFamily属性、一个是全局设置theme主题字体大小
@override
Widget build(BuildContext context) {
const FontWeight weightIos = FontWeight.w300;
//ios 字体样式
var themeDataIos = ThemeData(
textTheme: const TextTheme(
headline1: TextStyle(fontWeight: weightIos),
headline2: TextStyle(fontWeight: weightIos),
headline3: TextStyle(fontWeight: weightIos),
headline4: TextStyle(fontWeight: weightIos),
headline5: TextStyle(fontWeight: weightIos),
headline6: TextStyle(fontWeight: weightIos),
subtitle1: TextStyle(fontWeight: weightIos),
subtitle2: TextStyle(fontWeight: weightIos),
bodyText1: TextStyle(fontWeight: weightIos),
bodyText2: TextStyle(fontWeight: weightIos),
)
);
//默认字体样式
var themeDataDefault = ThemeData(
textTheme: const TextTheme(
headline1: TextStyle(fontWeight: FontWeight.normal),
headline2: TextStyle(fontWeight: FontWeight.normal),
headline3: TextStyle(fontWeight: FontWeight.normal),
headline4: TextStyle(fontWeight: FontWeight.normal),
headline5: TextStyle(fontWeight: FontWeight.normal),
headline6: TextStyle(fontWeight: FontWeight.normal),
subtitle1: TextStyle(fontWeight: FontWeight.normal),
subtitle2: TextStyle(fontWeight: FontWeight.normal),
bodyText1: TextStyle(fontWeight: FontWeight.normal),
bodyText2: TextStyle(fontWeight: FontWeight.normal),
)
);
return MaterialApp(
theme: Platform.isIOS ? themeDataIos : themeDataDefault,
home: JmHome(),
);
\
还可以通过在每个页面的根组件外面包一层DefaultTextStyle临时解决
Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: DefaultTextStyle(// 在Scaffold外面包也不生效,所以只能在body中加
style: TextStyle(
fontWeight: Platform.isIOS ? FontWeight.w300 : FontWeight.normal,
color: Colors.black
),
child: Text('组件 abc 1234')
)
)
3、 iOS15 小程序输入框键盘无法弹起问题
升级小程序组件库到JDMiniAppModule1.27.21、JDBAresAdapterModule 1.7.19
4、iOS15 起本地相册时,上方导航栏显示黑色问题
测试发下在调起相机是上方导航栏显示黑色,分析发下调起相册使用的导航是JDNavigationController,需要JDBUIKitModule基础库也要做iOS15适配,目前正在同步适配升级解决
5、 NSTextAttachment设置bounds失效问题会导致图片富文本乱掉。推荐使用YYLabel的YYAnimatedImageView (记得处理14.0 displayLayer问题)
6、 手机更新15.0之后,真机测试启动特别慢,升级了Xcode13也不行。
~/Library/Developer/Xcode/iOS DeviceSupport/ 清空里面的内容,Window->Devices and Simulators->(右键)Unpair Device->重启Xcode
7、 升级iOS15系统后,即使是低版本打的包也会出现截图被自动放大的问题
很多商家对此问题进行了反馈,发现iOS15可能对PHImageContentMode做了调整所以做一下适配:把PHImageContentModeAspectFill 改为 PHImageContentModeAspectFit,涉及升级组件有JDBMediaPickerModule 1.3.17 、JDMediaMakerModule 4.0.6适配iOS15图片放大