{
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray *allApplications = [workspace performSelector:@selector(allApplications)];
NSInteger zlConnt = 0;
for (NSString *appStr in allApplications) {
NSString *app = [NSString stringWithFormat:@"%@",appStr];//转换成字符串
NSRange range = [app rangeOfString:@"com.tencent.mqq"];//是否包含这个bundle ID
if (range.length > 1) {
zlConnt ++;
}
}
if (zlConnt >= 1) {
NSLog(@"com.tencent.mqq");
return YES;
}else{
return NO;
}
}
检查手机是否按照某个应用,这里以QQ为例,取QQ的bundID
最新推荐文章于 2020-03-25 14:53:22 发布