We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have the iOS application with CarPlay support. I don't see the NotificationBanner during CarPlay on the iPhone's display or CarPlay's display.
Because of bannerPositionFrame is nil here:
func show( placeOnQueue: Bool, queuePosition: QueuePosition = .back, bannerPosition: BannerPosition = .top ) guard bannerPositionFrame != nil else { remove(); return }
I investigated a little bit and found the next call stack where appWindow is nil:
appWindow is nil
internal func updateBannerPositionFrames() { guard let window = appWindow else { return } bannerPositionFrame = BannerPositionFrame(
/// The main window of the application which banner views are placed on private let appWindow: UIWindow? = { if #available(iOS 13.0, *) { return UIApplication.shared.connectedScenes .first { $0.activationState == .foregroundActive || $0.activationState == .foregroundInactive } .map { $0 as? UIWindowScene } .flatMap { $0?.windows.first } ?? UIApplication.shared.delegate?.window ?? UIApplication.shared.keyWindow } return UIApplication.shared.delegate?.window ?? nil }()
During CarPlay usage the connectedScenes can contain
connectedScenes
<CPTemplateApplicationScene: 0x10a556f50; role: CPTemplateApplicationSceneSessionRoleApplication; activationState: UISceneActivationStateForegroundActive> <UIWindowScene: 0x10a434c40; role: UIWindowSceneSessionRoleApplication; activationState: UISceneActivationStateForegroundActive>
I propose to use something like this:
var appWindow: UIWindow? { let scenes: [UIScene] = Array(UIApplication.shared.connectedScenes) let windowScenes: [UIWindowScene] = scenes.compactMap { $0 as? UIWindowScene } // avoid CarPlay CPTemplateApplicationScene let foregroundScene: UIWindowScene? = windowScenes.first { $0.activationState == .foregroundActive || $0.activationState == .foregroundInactive } return foregroundScene?.windows.first }
To avoid usage of type CPTemplateApplicationScene which cannot be converted to UIWindowScene.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have the iOS application with CarPlay support. I don't see the NotificationBanner during CarPlay on the iPhone's display or CarPlay's display.
Because of bannerPositionFrame is nil here:
I investigated a little bit and found the next call stack where
appWindow is nil
:During CarPlay usage the
connectedScenes
can containI propose to use something like this:
To avoid usage of type CPTemplateApplicationScene which cannot be converted to UIWindowScene.
The text was updated successfully, but these errors were encountered: