ios - LSApplicationWorkspace 不能在 iOS 11 上运行吗?

标签 ios iphone-privateapi ios11

我有一个私有(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/

相关文章:

ios - 在 iOS 8.3 中获取 CellID、MCC、MNC、LAC、信号强度、质量和网络

ios - WKWebKit takeSnapshot(带有快照配置:) not working on iOS device

swift - 添加注释后选择带有自定义标注的 MKMarkerAnnotationView

iphone - 使用 NSURL 访问本地文件

ios - 单例和委托(delegate)

ios - GSEventRegisterEventCallBack - 获取 View 更改通知

iphone - iPhone 应用程序中 NSHost 的替代品

xcode - 没有自动布局的 iPhone X 界面编程

android - 在模块 guava-26.0-android.jar 中发现重复的类 com.google.common.util.concurrent.ListenableFuture

ios - 从NSString转换为NSData