我有一个私有(private)的应用程序,它需要扫描所有应用程序和方案,并通过使用私有(private) API LSApplicationWorkspace defaultWorkspace
和其他功能方法来获取它,例如 privateURLSchemes
allInstalledApplications
。这个应用程序运行良好,我可以从 iOS 11 之前的私有(private) API 获得我需要的一切,但在这个版本中我只收到一些警告和一个空数组。 Apple 似乎限制了开发人员不能在 iOS 11 中私下使用的私有(private) API。
所以我的问题是在 iOS 11 中有哪些替代方法可以满足我的需求?
最佳答案
更新:此方法不适用于 iOS 12 - 需要授权
有一种方法可以找到是否安装了特定的应用程序,它不是返回所有应用程序的列表,如 allInstalledApplications
但它对于查询特定的 bundle id 很有用
这是一个例子,该方法接收 bundle id 并返回 true,如果它安装在设备上:
- (BOOL)checkIfAppInstalled: (NSString*)bundleID {
dlopen("/System/Library/PrivateFrameworks/MobileContainerManager.framework/MobileContainerManager",RTLD_NOW);
Class MBAppManager = NSClassFromString(@"MCMAppDataContainer");
NSError * error ;
id contentApp = [MBAppManager performSelector:@selector(containerWithIdentifier:error:) withObject:bundleID withObject:error];
return contentApp != nil;
}
关于ios - LSApplicationWorkspace 不能在 iOS 11 上运行吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44793215/