Allen0828/AEAlertView

iOS14 崩溃

Closed this issue · 1 comments

func showAlert() {
...
if #available(iOS 13, *) {
UIApplication.shared.keyWindow?.addSubview(self)
} else {
UIApplication.shared.delegate?.window??.addSubview(self)
}
...
}
UIApplication.shared.keyWindow 在iOS13以后被废弃

use:
if #available(iOS 14.0, *) {
let window = UIApplication.shared.windows.first { $0.isKeyWindow }
window?.addSubview(self)
} else if #available(iOS 13, *) {
UIApplication.shared.keyWindow?.addSubview(self)
} else {
UIApplication.shared.delegate?.window??.addSubview(self)
}
我会在更新功能时 同步 感谢