-
(NSArray *)getAllAppsFromDevice
{
//获取手机上所有的app
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject *workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray *apps = [workspace performSelector:@selector(allInstalledApplications)];
Class LSApplicationProxy_class = objc_getClass("LSApplicationProxy");
NSMutableArray *deviceApps = [NSMutableArray new];
for (int i = 0; i < apps.count; i++) {
NSObject *temp = apps[i];
if ([temp isKindOfClass:LSApplicationProxy_class]) {
ApplicationModel *appModel = [[ApplicationModel alloc] init];
NSString *tempKey = [temp performSelector:NSSelectorFromString(@"applicationIdentifier")];
if ([tempKey containsOtherString:@"apple"]) {
continue;
}
//版本
NSString *tempVersionNumber = [temp performSelector:NSSelectorFromString(@"shortVersionString")];
appModel.appNumber = tempVersionNumber;//bundle id
NSString *tempAppkey = [temp performSelector:NSSelectorFromString(@"applicationIdentifier")];
appModel.appKey = tempAppkey;
[deviceApps addObject:appModel];
}
}
return [deviceApps copy];
}
检测目前手机上都安装了哪些应用程序(非系统自带)苹果官方私有Api
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- #import <objc/runtime.h> - (NSArray *)getAllAppsFromDevic...
- 我们常常会听说 Objective-C 是一门动态语言,那么这个「动态」表现在哪呢?我想最主要的表现就是 Obje...