Ios12 app目录怎么一一对应的? 这个帖子里问怎么对应的。中间一串字母烦得很。
其实就是个命令行工具,用nic.pl 新建
[10.] iphone/tool
名字叫 lsapp
修改文件main.mm:
#import <objc/runtime.h>
#include <dlfcn.h>
int main(int argc, char **argv, char **envp) {
dlopen("/System/Library/PrivateFrameworks/ScreenshotServices.framework/ScreenshotServices", RTLD_LAZY);
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray*apps = [workspace performSelector:@selector(allApplications)]; // LSApplicationProxy
for (id obj in apps) { //obj is LSApplicationProxy
NSString * applicationIdentifier = [obj performSelector:@selector(applicationIdentifier)];
NSString * localizedName = [obj performSelector:@selector(localizedName)];
NSString * canonicalExecutablePath = [obj performSelector:@selector(canonicalExecutablePath)];
printf("%s(%s)===>%s\n",localizedName.UTF8String,applicationIdentifier.UTF8String,canonicalExecutablePath.UTF8String);
}
return 0;
}
make clean && make && make package && make install
安装到bin目录,直接
lsapp运行即可
运行截图: