我们可以像这样获得ios安装的bundle id列表:
Class lsawsc = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [lsawsc performSelector:NSSelectorFromString(@"defaultWorkspace")];
NSArray *arr = [workspace performSelector:NSSelectorFromString(@"allInstalledApplications")];
for (NSString * tmp in arr)
{
NSLog(@"%@", tmp);
}
arr(NSArray)是包ID列表。我想在调整时隐藏一些bundle id。但我不知道如何为钩子选择器编写代码...请帮助,谢谢!
答案 0 :(得分:0)
您可以使用已过滤的应用填充新数组并使用:
NSArray *installedApps = /* result of allInstalledApplications invocation */;
NSMutableArray *filteredApps = [NSMutableArray new];
for (NSString *app in installedApps) {
if (/* filter/hook allows app */) {
[filteredApps addObject:app];
}
}
// Use filteredApps
注意:LSApplicationWorkspace是一个私有API,因此使用它将阻止在Apple App Store中发布。