ALAlertBanner icon indicating copy to clipboard operation
ALAlertBanner copied to clipboard

Interrupted animation leads to top navigation bar 'deadlock'

Open dyang opened this issue 10 years ago • 2 comments

I'm experiencing a deadlock-like issue using ALAlertBanner in my iOS app. If I send the app to background while ALAlertBanner is displayed (but before it disappears), and then bring the app back into foreground, the banner disappears rather quickly, and then the app's top navigation bar stops to respond to user interactions (i.e. tapping on buttons won't work). The only way to get the top navigation bar back to work is to kill the app.

After I put in some logs here and there, I noticed that when this issue happens, the corresponding instance of ALAlertBanner is never released. After some more experiments, I find that animationDidStop:(CAAnimation *)animo finished:(BOOL)flag is called with flag set to NO when the issue happens. So my temp workaround is to remove the check of && flag so that the banner can still proceed to hide itself in such an event.

I think the core of the issue is, iOS appears to be in the habit of canceling a scheduled core animation when the app goes into background. When this happens, an animation receives an animationDidStop:finished: event with the last parameter set to NO instead of YES.

Please let me know if there's anything else that I can provide. Thanks!

dyang avatar Dec 30 '13 19:12 dyang

Lots of good info here, thanks!

Unfortunately, that flag check is needed when dealing with orientation changes while a banner(s) is being animated, so removing it might cause more problems than it fixes. I think the best solution here would be to force hide any open banners before backgrounding your app via forceHideAllAlertBannersInView:.

lobianco avatar Jan 02 '14 21:01 lobianco

I would prefer to handle "forced" dismissal of banners in a cleaner manner, which would hopefully help in this situation. I've been busy recently with other projects but that is on my radar :)

lobianco avatar Jan 02 '14 22:01 lobianco