Daltron / NotificationBanner

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

fix: unwrap of nil bannerPositionFrame on iOS 13+ #295

Closed tom139 closed 4 years ago

tom139 commented 4 years ago

Due to the new Scene behavior in iOS 13 there are some cases where the bannerPositionFrame in BaseNotificationBanner may be nil.

This always leads to a fatal error.

Proposed solution

The proposed solution is to change bannerPositionFrame from implicitly unwrapped optional to optional and force the code that deals with it to handle the case when the banner has no frame (e.g. because no Window is presented on screen).


Fixes #286

tom139 commented 4 years ago

Calling for help from @EdwinJr13 (the author of issue #286 ) and @gavrilaf (that worked on a workaround for issue #286).

I hope not to bother any of you 😁

gee1k commented 4 years ago

@Daltron I also have this problem. Could the author merge the pr repair problems?

L1cardo commented 4 years ago

Same here! Badly need this hot fix

tom139 commented 4 years ago

Ehi @L1cardo and @gee1k , just to let you know that if you use Cocoapods you can replace:

pod 'NotificationBannerSwift', '~> 3.0'

with:

pod 'NotificationBannerSwift', :git => 'https://github.com/tom139/NotificationBanner.git', :branch => 'tom139/fix-bannerpositionframe-unwrapping-ios13'

in your Podfile to point my fork and the tip of the branch of this PR. Then you should run pod install to replace the old version with the one from my branch.

I will not maintain this solution forever but will keep the branch aligned with the upstream master and those fixes will be included.

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.