Created
October 20, 2019 21:06
-
-
Save CPDigitalDarkroom/e96a20f9011ce13e93377ad4c2e7a4b7 to your computer and use it in GitHub Desktop.
Open an app shortcut programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Only work on jailbreak device?