-
-
Save neoighodaro/3b573e8f29d09d504d25cc1d3ba26570 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