Daltron / NotificationBanner

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

Getting Random crash #378

Open vivek-Jeeves opened 2 years ago

vivek-Jeeves commented 2 years ago

Crashed: com.apple.main-thread 0 libswiftCore.dylib 0x38648 closure #1 in closure #1 in closure #1 in assertionFailure(:_:file:line:flags:) + 456 1 libswiftCore.dylib 0x37ac0 assertionFailure(:_:file:line:flags:) + 472 2 NotificationBannerSwift 0x112a0 $s23NotificationBannerSwift04BaseaB0C4show12placeOnQueue13queuePosition06bannerJ0ySb_AA0hJ0OAA0bJ0OtF + 1308 3 NotificationBannerSwift 0x2aa88 $s23NotificationBannerSwift0aB5QueueC03addB0_14bannerPosition05queueG0yAA04BaseaB0C_AA0bG0OAA0dG0OtF + 1032 4 NotificationBannerSwift 0x11204 $s23NotificationBannerSwift04BaseaB0C4show12placeOnQueue13queuePosition06bannerJ0ySb_AA0hJ0OAA0bJ0OtF + 1152 5 NotificationBannerSwift 0x10ccc $s23NotificationBannerSwift04BaseaB0C4show13queuePosition06bannerG00F02onyAA05QueueG0OAA0bG0OAA0abJ0CSo16UIViewControllerCSgtF + 236 6 0x267cf4 showTostAlert(title:subTitle:leftView:rightView:style:color:) + 700 (Utility.swift:700) 7 0x2675b8 displayToast(:style:) + 399 (Utility.swift:399) 8 0x2aac24 AppDelegate.wsversioning() + 78 (AppDelegate.swift:78) 9 0x2aa4b8 AppDelegate.applicationDidBecomeActive(:) + 63 (AppDelegate.swift:63) 10 0x2aa508 @objc AppDelegate.applicationDidBecomeActive(_:) + 60 (:60) 11 UIKitCore 0xa63874 -[UIApplication _stopDeactivatingForReason:] + 1172 12 UIKitCore 0x1dd34c -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 436 13 UIKitCore 0x1dd6b0 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 756 14 UIKitCore 0x1dcf38 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 340 15 UIKitCore 0x1e1654 186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 196 16 UIKitCore 0x5c6f8c +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 856 17 UIKitCore 0x6c222c _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 260 18 UIKitCore 0x1e1390 186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 156 19 UIKitCore 0x6c2114 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 108 20 UIKitCore 0x1e11e8 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 392 21 UIKitCore 0x47918 64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 640 22 UIKitCore 0x46418 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 256 23 UIKitCore 0x47648 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 236 24 UIKitCore 0x5edc18 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 480 25 FrontBoardServices 0xdb7c -[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:] + 544 26 FrontBoardServices 0x33b68 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke_2 + 136 27 FrontBoardServices 0x17f40 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240 28 FrontBoardServices 0x33a84 88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke + 200 29 libdispatch.dylib 0x35ac _dispatch_client_callout + 20 30 libdispatch.dylib 0x633c _dispatch_block_invoke_direct + 264 31 FrontBoardServices 0x596c8 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 48 32 FrontBoardServices 0x59374 -[FBSSerialQueue _queue_performNextIfPossible] + 432 33 FrontBoardServices 0x598e0 -[FBSSerialQueue _performNextFromRunLoopSource] + 32 34 CoreFoundation 0xacd14 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 35 CoreFoundation 0xacc68 CFRunLoopDoSource0 + 84 36 CoreFoundation 0xac3c4 CFRunLoopDoSources0 + 188 37 CoreFoundation 0xa71fc __CFRunLoopRun + 780 38 CoreFoundation 0xa6bc8 CFRunLoopRunSpecific + 480 39 GraphicsServices 0x35cc GSEventRunModal + 164 40 UIKitCore 0xa6e744 UIApplicationMain + 1936 41 0x2acc40 main + 20 (AppDelegate.swift:20) 42 libdyld.dylib 0x1384 start + 4

djblake commented 2 years ago

I am getting the same crash

djblake commented 2 years ago

I seems to have fixed it (at least so far haven't noticed any more crashes) by making bannerPositionFrame optional, then everywhere its referenced just use the nil coalescing operator to set it to .zero instead. eg. self.frame = self.bannerPositionFrame?.endFrame ?? .zero ... also I made startFrame and endFrame inside bannerPositionFrame non optional and set it .zero initially. At some point I'll upload the changes to a fix and make a pull request, but for now you can just download the files, copy them over manually, make the changes, and add 'SnapKit' and 'MarqueeLabel' dependancies to your pod file.

alexookah commented 2 years ago

https://github.com/Daltron/NotificationBanner/pull/376 there is already a PL that should fix the random crash. Did you make some furether changes that fixes the crash?

stale[bot] commented 2 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.