历来AppStore提审新版本都是很顺畅,基本都是晚上提审隔天就通过了,这一次竟眼睁睁的看着“审核中”一天,感觉不妙,结果第三天果真被拒,貌似是因为使用了即将废弃的API,不得不说App审查是越发的严格了。

首先查找项目中关于PhotoLibrary使用的地方,既然是PhotoLibrary那肯定就是相册选择照片了。查看了API

于是就发现UIImagePickerController.sourceType部分属性和相册选择回调mediaInfo的部分常量key即将废弃,于是加入了关于PHPickerViewController的适配。
图片选择适配:


视频选择适配:


关于PHPickerViewController相册选择照片、视频的资料真少,即使找到若干个发现根本不生效,折腾了好久都快崩溃了。
过程还有坑,我本机是iOS15系统,用网上推荐的loadItemForTypeIdentifier:方法拿到视频了,以为问题解决。结果到测试那给我打回来了,说无法选择,确实iOS16系统此方法有失效了....无语了
以为是identifier传的可能不对,又尝试了好久还是不行,最后实在没办法只能去官方文档看下了,看一遍根本没说选视频的事,举例都是图片选择,图片选择我弄好了我不要看这个。抱一丝幻想下个demo看看,有,泰裤辣泰裤辣,赶紧跟着demo撸一遍,果然可以。必须用loadFileRepresentationForTypeIdentifier:的方式
网友评论