forked from coolstar/uikittools-ng
-
Notifications
You must be signed in to change notification settings - Fork 2
/
uiopen.m
22 lines (18 loc) · 816 Bytes
/
uiopen.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <dlfcn.h>
#include <Foundation/Foundation.h>
@interface LSApplicationWorkspace : NSObject
+ (id)defaultWorkspace;
- (BOOL)openSensitiveURL:(NSURL *)url withOptions:(NSDictionary *)options;
@end
int main(int argc, char *argv[]) {
if (argc < 2) {
fprintf(stderr, "Usage: %s url\n", argv[0]);
return 1;
}
NSURL *url = [NSURL URLWithString:[NSString stringWithUTF8String:argv[1]]];
void *fbs = dlopen("/System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices", RTLD_NOW);
NSString **FBSOpenApplicationOptionKeyUnlockDevice = dlsym(fbs, "FBSOpenApplicationOptionKeyUnlockDevice");
[[LSApplicationWorkspace defaultWorkspace] openSensitiveURL:url withOptions:@{*FBSOpenApplicationOptionKeyUnlockDevice:@YES}];
return 0;
}