iOS小课堂:iOS16新特性(适配)

653 阅读2分钟

“开启掘金成长之旅!这是我参与「掘金日新计划 · 2 月更文挑战」的第 15 天,点击查看活动详情

引言

Session 网页版:https://developer.apple.com/wwdc22/sessions

2022年9月苹果发布xcode14及iOS16,苹果每年都要求开发者提交应用市场App的xcode版本,因为我们需要提前做好充分准备。

developer.apple.com/cn/ios/subm…

I Xcode14新特性

Xcode 14 中新的编译器和链接器已经将 ARM64 的消息发送调用从 12 字节减少到 8 字节,因此如果是 OC 代码的话,使用 Xcode 14 编出来的二进制文件可以少 2%(老系统也有效)。 下载 Xcode 14 beta https://developer.apple.com/download/applications/ 7个G 。

blog.csdn.net/z929118967/…

II iOS16 新特性

2.1 真机调试

iOS 16真机调试时需要在设备的设置 —> 隐私与安全 —> 开发者模式中打开开发者模式。

Before testing your software on your device, make sure to enable Developer Mode in Settings > Privacy & Security.

Xcode14编译的时候,第三方库QMUIResources需要选择开发团队进行签名。

Pods/Pods.xcodeproj error project: Signing for "QMUIKit-QMUIResources" requires a development team. Select a development team in the Signing & Capabilities editor.

2.2 组件API

  1. 日历视图UICalendarView支持单选与多选日期,无法显示时分秒,如需时分秒建议继续使用 UIDatePicker

A view that displays a calendar with date-specific decorations, and provides for user selection of a single date or multiple dates.

developer.apple.com/documentati…

  1. 下载队列管理器: BADownloadManager
  2. 将 View 生成图片: ImageRenderer

iOS小技能:保存图片到相册( 监听用户的相册授权动作)https://blog.csdn.net/z929118967/article/details/126466919

2.3 锁定模式(Lockdown Mode)

iOS 16 和 macOS Ventura 开始,对安全性有特殊需求的用户可以在系统设置中启用 Lockdown Mode 来牺牲一部分系统功能,但关闭一些潜在的攻击面。 在这里插入图片描述

The Lockdown Mode capability further hardens device defenses and strictly limits certain functionalities, sharply reducing the attack surface that could potentially be exploited by highly targeted mercenary spyware.

www.apple.com/newsroom/20…

启用之后增加如下策略:

  • 短信:除图片外,屏蔽大部分的 iMessage 附件功能。链接预览将被禁用
  • 浏览器:默认禁用一些复杂的 Web 功能,例如即时编译优化(JIT),除非用户针对特定网站开启
  • Apple 服务:默认屏蔽来自陌生人的邀请,包括 FaceTime,除非之前有过通话或者请求记录
  • iPhone 锁屏状态下不再允许 USB 连接电脑或接入外部设备(如读卡器)
  • 配置文件无法安装,无法加入 MDM(移动设备管理)

III 字典转模型发生死循环

data" : {
    "pageSize" : 20,
    "totalCount" : 0,
    "order" : "SubstituteDT DESC",
    "data" : [

    ],
    "pageCount" : 0,
    "footers" : null,
    "page" : 1
  },
  "error" : false

iOS16.0系统解析接口数据返回空数组[],发生字典转模型发生死循环。

修复:当数组个数大于0才进行模型转换

                NSArray *dataArr =data[@"data"];
                
                if([dataArr isKindOfClass:NSArray.class] && dataArr.count>0){
                    
                    NSMutableArray* tmparrresult = [ERPSubstituteDto mj_objectArrayWithKeyValuesArray:responseObj[@"data"][@"data"]];

see also

https://developer.apple.com/ios/