Banners get stuck if Application goes to background whilst they are appearing
This seems to be a similar issue to if the view Disappears, but the workaround for that (calling forceHideAllAlertBannersInView:) doesn't seem to do the job here.
To reproduce: perform an action that causes some banners to appear in your app, then put the app to background (i.e. press the Home button) whilst the banners are still appearing. (That they are still appearing/queued to appear seems to be key to reproducing.)
I have tried subscribing to UIApplicationDidEnterBackgroundNotification, to call forceHideAllAlertBannersInView. But when returning to the app I usually see at least one Banner appear and others remain - no longer able to dismiss them with a tap. At this point, no further banners will ever appear - calling forceHideAllAlertBannersInView: from viewWillDisappear: will not reset the situation.
I have the same issue. any solution ?
I have a temporary solution until fixing completely.
I added these lines before showing banner,
UIApplication *application = [UIApplication sharedApplication];
UIApplicationState appCurrentState = [application applicationState];
if(appCurrentState == UIApplicationStateActive)
{
//create and show ALAlertBanner
}
I've gone for re-initialising all three semaphores in the forceHideAllAlertBannersInView: method, so that they're in a known "good" state.
can you share your solution ?
https://github.com/jamesrgrinter/ALAlertBanner/commit/2c3e3b36aa88fba81bcfbb47fcdbdbc8196669ab is my fix to ALAlertBanner - though I'm not saying that this is the right fix, it's actually a bit of a sledgehammer approach that it resets the semaphores that are used to prevent more than one animation at a time.
My own app code then calls forceHideAllAlertBannersInView: from viewWillDisappear: in whichever views they're shown, but also adds an observer for UIApplicationDidEnterBackgroundNotification in those views so that it can invoke the method when the app enters the background.
@jamesrgrinterThank you I've been struggling with this! When the app enters background though the managers still gets confused even with the observer. Or am I doing it wrong?