#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#include <objc/runtime.h>
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");
for (
int i =
0; i < apps
.count; i++) {
NSObject *temp = apps[i];
if ([temp isKindOfClass:LSApplicationProxy_class]) {
NSString *appBundleId = [temp performSelector:NSSelectorFromString(@
"applicationIdentifier")];
NSString *appName = [temp performSelector:NSSelectorFromString(@
"localizedName")];
NSString * type = [temp performSelector:NSSelectorFromString(@
"applicationType")];
NSString * shortVersionString = [temp performSelector:NSSelectorFromString(@
"shortVersionString")];
NSLog(@
"类型=%@应用的BundleId=%@ ++++应用的名称=%@版本号=%@",type,appBundleId,appName,shortVersionString);