Skip to content

Instantly share code, notes, and snippets.

@CPDigitalDarkroom
Created October 20, 2019 21:06
Show Gist options
  • Save CPDigitalDarkroom/e96a20f9011ce13e93377ad4c2e7a4b7 to your computer and use it in GitHub Desktop.
Save CPDigitalDarkroom/e96a20f9011ce13e93377ad4c2e7a4b7 to your computer and use it in GitHub Desktop.
Open an app shortcut programmatically
- (void)openShortcut:(SBSApplicationShortcutItem *)shortcutItem {
UIHandleApplicationShortcutAction *openAction = [[UIHandleApplicationShortcutAction alloc] initWithSBSShortcutItem:shortcutItem];
NSDictionary *activationOptions = @{
@"__ActivateSuspended" : [NSNumber numberWithBool:(shortcutItem.activationMode == 1)],
@"__Actions": @[
openAction
],
@"__PromptUnlockDevice" : [NSNumber numberWithBool:YES],
@"__LaunchOrigin": @"__SBLaunchOriginShortcutItem"
};
FBSOpenApplicationOptions *applicationOptions = [FBSOpenApplicationOptions optionsWithDictionary: activationOptions];
FBSOpenApplicationService *openService = [[FBSOpenApplicationService alloc] init];
[openService openApplication: shortcutItem.bundleIdentifierToLaunch withOptions:applicationOptions completion:nil];
}
@caichunjian520
Copy link

Only work on jailbreak device?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment