赞
踩
在这里插入代码片
问题报错:‘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!
}
}()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。