Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray*allApplications = [workspace performSelector:@selector(allApplications)];//这样就能获取到手机中安装的所有App
NSLog(@"设备上安装的所有app:%@",allApplications);NSIntegerzlConnt =0;
for(NSString*appStrinallApplications) {
NSString*app = [NSStringstringWithFormat:@"%@",appStr];//转换成字符串
NSRangerange = [app rangeOfString:@"你要查询App的bundle ID"];//是否包含这个bundle ID
if(range.length >1) {
zlConnt ++;
}
}
if(zlConnt >=1) {
NSLog(@"已安装");
}