I wrote a tweak for Cydia, it adds an icon to the status bar. It works fine on the home screen and when SpringBoard is launched, also, if an app is already launched then it works fine, however, if an app (such as Facebook or Twitter) is closed (completely) and the icon is showing, when launching the app, it will cause the icon to disappear. The icon is displayed using libStatusBar using this code:
if(icon) // if icon needs to be removed
{
[icon release];
icon = nil;
}
...
// add the icon to the status bar
icon = [[%c(LSStatusBarItem) alloc] initWithIdentifier:[NSString stringWithFormat:@"muteIconLablabla"] alignment:StatusBarAlignmentRight];
icon.imageName = [NSString stringWithFormat:@"Mute"];
I also tried using the methods suggested in libStatusBar
README file
[[UIApplication sharedApplication] addStatusBarImageNamed:@"ON_Mute"]; // and removeStatusBarImageNamed:...
I tried overriding -(id)init
and updating the icon there, but the same result.
The code shown above is being called from a static void
function. this function is being called several times, for example from -(void)applicationDidFinishLaunching:(id)application
under %hook SpringBoard
and -(void)ringerChanged:(int)changed
All inside Tweak.xm
.
The problem happens in iOS7
as well.