iOS16和Xcode14升级适配

iOS16:

问题:

粘贴板弹框问题

解决方案:

1、iOS16及以上可以使用新API,UIPasteControl代替UIPasteBoard解决该问题;
2、设置中可以设置相应权限解决该问题

问题:

UIDevice 获取设备名称时,无法获取用户自定义名称,例如iOS16之前:苏打水kesee1 iPhone 13 Pro Max ,iOS16之后:iPhone 13 Pro Max

解决方案:

隐私权限增强,无法获取

问题:UIDeviceOrientationDidChangeNotification通知无法触发

解决方案:

iOS16使用windowScene代理方法监听方向变化//

- (void)windowScene:(UIWindowScene *)windowScene didUpdateCoordinateSpace:(id<UICoordinateSpace>)previousCoordinateSpace interfaceOrientation:(UIInterfaceOrientation)previousInterfaceOrientation traitCollection:(UITraitCollection *)previousTraitCollection  API_AVAILABLE(ios(13.0)){
    //相应的UI变化    
}

iOS15及之前app代理方法supportedInterfaceOrientationsForWindow返回UIInterfaceOrientationMaskAll
app代理didFinishLaunchingWithOptions增加[[UIDevice currentDevice] beginGeneratingDeviceOriengationNotifications]

Xcode14:

问题:Pod工程中的Bundle target签名报错

解决方案:

1、手动选择Pod工程中的Bundle target 签名中的Team,与主工程一致
2、在Podfile脚本中设置你的开发者的Team ID
3、在Podfile脚本中设置CODE_SIGN_IDENTITY为空来避免报错
4、podfile中设置User-Defined CODE_SIGNING_ALLOWED = NO

问题:xcode14打包ipa在iOS12.2以下设备闪退问题 错误:

Dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib

解决方案:

1、BuildSetting -> Other Links Flags 添加 -WL,-weak-lswiftCoreGraphics
2、Build Phase -> Link Binary With Libraries 增加libswiftCoreGraphics.tdb
3、Pods 第三方库报错在相应位置添加同样配置

问题:xcode14打包移除armv7架构,出armv7架构包只能使用低版本xcode

解决方案:

使用xcode14以下版本出armv7架构包
问题:升级xcode14后编译报错

xcode14 project compile error:com.apple.xcode.tools.swift.compiler is not absolute

解决方案:

1、升级framework
2、User Header Search Paths 删除${PROJECT_DIR}/Pods

iOS16和Xcode14:

问题:UIDevice 不再支持通过 setValue() 方法设置设备的方向,

xcode14编译旧项目出现下面问题, 找不到方法闪退.

<_UINavigationBarContentViewLayout 0x7f7f53f58a40> valueForUndefinedKey:]: this class is not key value coding-compliant for the key inlineTitleView.

解决方案:

iOS16及以上使用requestGeometryUpdate设置设备方向,iOS16以下使用setValue
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容