brunow / BWStatusBarOverlay

BWStatusBarOverlay is a custom status bar overlay window.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thread issues

Wisors opened this issue · comments

The status bar with duration failed dismiss if you use it not in the main thread. Your thread exit earlier then the method performSelector:withObject:afterDelay:duration will be invoked.

Solution:
Modify the next method:

  • (void)showMessage:(NSString *)message withStatus:(BWStatusBarOverlayStatus)status duration:(NSTimeInterval)duration animated:(BOOL)animated

You should add run loop at the end of this method:
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:duration]];

It prevent the exit of statusBar's thread.

commented

But this is a UI stuff, why shouldn't it be called on the main thread?