Here is the best way to solve my problem:
%new(v@:@)
-(void)launch:(NSString *)bundle {
Class SBApplicationController = objc_getClass("SBApplicationController");
id appController = [SBApplicationController sharedInstance];
NSArray *apps = [appController applicationsWithBundleIdentifier: bundle];
if ([apps count] > 0) {
//Wait .5 seconds.. then launch.
[self performSelector:@selector(launchTheApp:) withObject:[apps objectAtIndex:0] afterDelay: 0.5];
} else {
id app = [appController applicationWithDisplayIdentifier: bundle];
if (app) {
//Wait .5 seconds.. then launch.
[self performSelector:@selector(launchTheApp:) withObject:app afterDelay: 0.5];
}
}
}
%new(v@:@)
-(void)launchTheApp:(id)app {
Class SBUIController = objc_getClass("SBUIController");
id uiController = [SBUIController sharedInstance];
if([uiController respondsToSelector:@selector(animateLaunchApplication:)]) {
[uiController animateLaunchApplication:app animateDefaultImage:YES];
} else {
[uiController activateApplicationFromSwitcher:app];
}
}
Note: activateApplicationFromSwitcher
will work better then activateApplicationAnimated