Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - status bar randomly turns solid black

Developing an iPhone app.

I've got a really strange problem where, every once in a while, the status bar at the top of my app screen will turn solid black. Not like the black version of the status bar, but like a solid black rectangle with NO text/icons. It's very rare, but usually seems to occur after returning to the app via multi-tasking or from a locked device (the app has been running in the background). I've seen it occur on both 3GS and iPhone4. Here's a screenshot:

enter image description here

I can never reproduce it when trying, it just seems to eventually happen at some point (sometimes it will go for days without happening).

Once it does occur, the app seems to continue functioning fine, even with the status bar gone, except for when I do one specific action in the app which will cause everything to freeze up all the sudden (the app doesn't crash, but everything on screen is frozen and non-interactive). Without explaining the design in detail, the specific action that causes it to freeze up (after the bug appears) is performing a simple upload in the background to a SQL database. Resetting the app is the only way to fix the problem once the black status bar appears.

Anyone else ever experienced this? I can't find a single thread anywhere explaining similar behavior, and it's driving me nuts.

like image 699
Gabe Avatar asked Nov 05 '22 02:11

Gabe


1 Answers

It happened once in my app when I called a drawing method in my custom subclass of UIView instance right before I added it as a subview to parent view.

The solution was apparently easy: add it as a subview first before sending/calling any custom drawing methods.

Examples:

CustomView *aView = [[CustomView alloc] init];

[aView drawSomething];

[self.view addSubview:aView]; //wrong approach
[aView release];

Should be:

CustomView *aView = [[CustomView alloc] init];

[self.view addSubview:aView];
[aView release];

[aView drawSomething];
like image 54
tebo Avatar answered Nov 12 '22 17:11

tebo