fix(iOS): fix presentActivitySheet keyWindow deprecation, use windowScene.keyWindow + fallback
This commit is contained in:
parent
bfb7631714
commit
75a319d7fb
@ -354,11 +354,16 @@ final class HLSRecorder: ObservableObject {
|
||||
return
|
||||
}
|
||||
|
||||
// 找最顶层可见的 VC(遍历所有 window)
|
||||
// 找最顶层可见的 VC:先用 keyWindow,再 fallback 到任意 window
|
||||
var topVC: UIViewController?
|
||||
for window in windowScene.windows where window.isKeyWindow {
|
||||
topVC = window.rootViewController
|
||||
break
|
||||
if let keyWindow = windowScene.keyWindow {
|
||||
topVC = keyWindow.rootViewController
|
||||
}
|
||||
if topVC == nil {
|
||||
for window in windowScene.windows where !window.isHidden && window.bounds.size != .zero {
|
||||
topVC = window.rootViewController
|
||||
if topVC != nil { break }
|
||||
}
|
||||
}
|
||||
if topVC == nil {
|
||||
topVC = windowScene.windows.first?.rootViewController
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user