Daltron / NotificationBanner

The easiest way to display highly customizable in app notification banners in iOS
MIT License
4.79k stars 663 forks source link

Banner isn't showing in 3.0.0 #258

Closed carmelogallo closed 4 years ago

carmelogallo commented 5 years ago

Replacing

private let appWindow: UIWindow? = {
    if #available(iOS 13.0, *) {
        return UIApplication.shared.connectedScenes
            .first { $0.activationState == .foregroundActive }
            .map { $0 as? UIWindowScene }
            .map { $0?.windows.first } ?? UIApplication.shared.delegate?.window ?? nil
    }

    return UIApplication.shared.delegate?.window ?? nil
}()

with

private let appWindow: UIWindow? = {
   return UIApplication.shared.keyWindow
}()

solved the problem.

kevincador commented 5 years ago

Hi,

I'm having the same kind of problem. The issue is that I have multiple windows in my app that shows overlay things on top of the main window.

My fix was to get the last window instead of the first. So:

private let appWindow: UIWindow? = {
    if #available(iOS 13.0, *) {
        return UIApplication.shared.connectedScenes
            .first { $0.activationState == .foregroundActive }
            .map { $0 as? UIWindowScene }
            .map { $0?.windows.last } ?? UIApplication.shared.delegate?.window ?? nil
    }

    return UIApplication.shared.delegate?.window ?? nil
}()

I think it's better and will work with more code base.

roasted-almond commented 4 years ago

I'm facing this issue too on iOS 13. Suggested solutions to change from "first" to "last" works. Thanks! Is this in any PR?

JMCPH commented 4 years ago

Has any of you made PR on this issue? Else I will do it.

carmelogallo commented 4 years ago

@JMCPH Feel free to do it.

marcheimendinger commented 4 years ago

The fix in merged PR #254 doesn't seem to be present in the latest version of the library. Is it true ?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed due to inactivity.

roasted-almond commented 4 years ago

Hi there, it seems this fix is not included in latest library. Shall we reopen the PR?