在这里插入代码片
问题报错:‘windows’ was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead
let keyWindow:UIWindow = {
if #available(iOS 13.0, *) {
return UIApplication.shared.windows.filter({ $0.isKeyWindow }).last!
}else {
return UIApplication.shared.keyWindow!
}
}()
更改为
let keyWindow : UIWindow? = {
if #available(iOS 13.0, *) {
return UIApplication.shared.connectedScenes.filter { $0.activationState == .foregroundActive }
.compactMap { $0 as? UIWindowScene }.first?.windows
.filter { $0.isKeyWindow }.first;
}else {
return UIApplication.shared.keyWindow!
}
}()
原文地址:https://blog.csdn.net/zeau163/article/details/128002106
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_25326.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!