I know that other applications can call from your application via the URL schema. But not all applications are registered schema URL. So how can I launch that application?. I'm developing for iphone jaibroken.
-
If your code is not in notification center, or a Mobile Substrate tweak (which WrightCS's answer addresses), then you [can use this other technique](http://stackoverflow.com/a/11713035/119114) – Nate Jul 31 '12 at 02:06
4 Answers
There are several ways you can launch an app using the Bundle ID.
SBApplication
SBApplication *app = [[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:@"com.wrightscs.someapp"];
[[objc_getClass("SBUIController") sharedInstance] activateApplicationFromSwitcher: app];
SBApplicationController
SBUIController *uicontroller = (SBUIController *)[%c(SBUIController) sharedInstance];
SBApplicationController *appcontroller = (SBApplicationController *)[%c(SBApplicationController) sharedInstance];
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)])
{
[uicontroller activateApplicationFromSwitcher:[[appcontroller applicationsWithBundleIdentifier:bundleID] objectAtIndex:0]];
}
else
{
// doesn't work outside of Springboard
[uicontroller activateApplicationAnimated:[[appcontroller applicationsWithBundleIdentifier:bundleID] objectAtIndex:0]];
}
There was another method I used in 4.x and SBUIController
but that stopped working in 5.0 so I'm not going to post it.

- 50,551
- 22
- 134
- 186
-
I also tried the above then. But to the IOS 5x is not working. You have found a way to launch applications on IOS 5x it is excellent. Can you suggest me some direction? Thanks – jewel Jul 28 '12 at 17:02
-
These work. You're just not doing something right. I use this in a few tweaks on Cydia. – WrightsCS Jul 28 '12 at 20:18
-
Use this code either in a Notification Center tweak or a MobileSubstrate tweak. If you are trying to use it in an app, you'll need to make a substrate tweak to call from the app. – WrightsCS Jul 28 '12 at 20:20
-
1FYI `-[SBUIController activateApplicationFromSwitcher:]` works in iOS6 too. In iOS5 i was using `-[SpringBoard applicationOpenURL:publicURLsOnly:]` passing `doubletap://display-identifier` but this schema is not supported anymore. – Zmaster Sep 19 '12 at 19:38
I used this way:
void* sbServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) = dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");
int result = SBSLaunchApplicationWithIdentifier((CFStringRef)bundleId, false);
dlclose(sbServices);
And you need entitlements granted to your app:
<key>com.apple.springboard.launchapplications</key>
<true/>
It can run on iOS 6.
-
Can you tell use how to get the API SBSLaunchApplicationWithIdentifier's param? – user501836 Feb 28 '14 at 13:15
-
As I know, only private api can do this. First
@interface PrivateApi_LSApplicationWorkspace
- (bool)openApplicationWithBundleID:(id)arg1;
@end
then use it
PrivateApi_LSApplicationWorkspace* _workspace;
_workspace = [NSClassFromString(@"LSApplicationWorkspace") new];
[_workspace openApplicationWithBundleID:bundleIdentifier];
You can check https://github.com/wujianguo/iOSAppsInfo.

- 231
- 2
- 8
I have tested just now: working in iOS 9.3.5 & 11.2 and also this method do not require any includes or dynamics loading of libs. Relies fully on obj-c runtime. And also this method do not require jailbroken device, can be done with xcode device and free developer account with provisioning profiles. Don't think that it would pass App store review process, but can be succesfully used in enterprise or ad-hoc destribution and so on.
id wrkS;
wrkS = [NSClassFromString(@"LSApplicationWorkspace") performSelector:@selector(defaultWorkspace)];
[wrkS performSelector:@selector(openApplicationWithBundleID:) withObject:@"com.apple.reminders"];

- 25
- 5