Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[iOS] Open an application from the command line by bundle identifier
@import Foundation;
@import MobileCoreServices;
@interface LSApplicationWorkspace : NSObject
+ (instancetype)defaultWorkspace;
- (BOOL)openApplicationWithBundleID:(NSString *)bundleID API_AVAILABLE(ios(7.0));
int main(int argc, char *argv[]) {
const char *firstArg = argv[1];
if (!firstArg) {
fprintf(stderr, "Usage: %s <bundleID>\n", argv[0]);
return 1;
NSString *bundleID = @(firstArg);
return [LSApplicationWorkspace.defaultWorkspace openApplicationWithBundleID:bundleID] ? EXIT_SUCCESS : EXIT_FAILURE;
Copy link

leptos-null commented Dec 26, 2019

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