已安装app
- (IBAction)lsapplicationBtnClicked:(UIButton *)sender {
_curBtnLbl.text = sender.titleLabel.text;
NSLog(@"LSApplication check");
NSString* resultStr = @"TODO";
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray *allAppList = [workspace performSelector:@selector(allApplications)];
resultStr = [NSString stringWithFormat: @"已安装app总数: %d", [allAppList count]];
resultStr = [NSString stringWithFormat: @"%@\n非系统app列表:", resultStr];
for (int i=0; i<[allAppList count]; i++) {
id appProxy = [allAppList objectAtIndex:i];
NSString* bundleId =[appProxy performSelector:@selector(applicationIdentifier)];
NSString* name = [appProxy performSelector:@selector(localizedName)];
NSString* version = [appProxy performSelector:@selector(bundleVersion)];
NSObject *description = [appProxy performSelector:@selector(description)];
NSArray *plugInKitPlugins = [appProxy performSelector:@selector(plugInKitPlugins)];
if(![bundleId hasPrefix: @"com.apple."]) {
resultStr = [NSString stringWithFormat: @"%@\n[%d] bundleId=%@, name=%@, version=%@, description=%@, plugInKitPlugins=%@", resultStr, i, bundleId, name, version, description, plugInKitPlugins];
}
}
NSLog(@"resultStr=%@", resultStr);
_detectResultTv.text = resultStr;
}