iOS11 获取手机已安装应用列表
在iOS 11 以前我们可以使用LSApplicationWorkspace来获取手机上已安装的应用列表
iOS 11 上获取所有已安装应用接口被禁,但可以根据BundleId检查App是否存在
- (BOOL)isInstalled:(NSString *)bundleId {NSBundle *container = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];if ([container load]) {Class appContainer = NSClassFromString(@"MCMAppContainer"); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wundeclared-selector"id container = [appContainer performSelector:@selector(containerWithIdentifier:error:) withObject:bundleId withObject:nil]; #pragma clang diagnostic popNSLog(@"%@", [container performSelector:@selector(identifier)]);if (container) {return YES;} else {return NO;}}return NO; }
此方法在iOS8中不起作用,经笔者验证,此方法在iOS9以上系统可正确运行。
老方法LSApplicationWorkspace,经笔者验证在iOS8 ~ iOS10均可正常获取所有已安应用
附老方法代码
#pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks"Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");SEL selector = NSSelectorFromString(@"defaultWorkspace");NSObject* workspace = [LSApplicationWorkspace_class performSelector:selector];SEL selectorALL = NSSelectorFromString(@"allInstalledApplications"); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wundeclared-selector"NSArray *allInstallApps = [workspace performSelector:selectorALL];for (NSObject *obj in allInstallApps) {NSString *appBundleId = [obj performSelector:@selector(applicationIdentifier)];NSLog(@"installed %@", appBundleId);} #pragma clang diagnostic pop // -Wundeclared-selector #pragma clang diagnostic pop // -Warc-performSelector-leaks
更多私有API探索,感兴趣的同学可用此工具浏览,不幸的是貌似在iOS11上不能完美运行
转载于:https://www.cnblogs.com/ciml/p/9224826.html
iOS11 获取手机已安装应用列表相关推荐
- 获取计算机软件列表,获取计算机已安装软件列表解决方法
获取计算机已安装软件列表 Dear all, 最近小弟在做一个应用程序,就是仿造360软件管家,获取计算机里已安装软件列表, 现思路如下,根据注册表路径: 针对x86系统,HKEY_LOCAL_MAC ...
- android 获取已安装列表权限,Android 如何完整的获取到用户已安装应用列表
接到产品经理的预研需求,说希望获取用户已安装应用列表.这个问题应该不难,只要是要把相关的知识点整理和验证一下. 对于获取用户已安装应用列表,我个人是很熟悉的,因为我的华为手机上,手机管家天天会在通知栏 ...
- android 获取已安装 错误代码,android获取手机已经安装的app信息
Android获取手机已安装APP(系统/非系统) 效果图 主体代码 private ListView mlistview; private ListpackageInfoList; private ...
- Android不同版本读取已安装应用列表权限相关问题
转载自:https://blog.csdn.net/u010844304/article/details/111044338 如何在Android 11 上获取已安装应用列表在Android 11上, ...
- 如何获取IOS手机已安装app的bundleid
获取IOS手机已安装app的bundleid 如果使用oc私有api获取不到ios11以上手机的app bundleid 那么可以使用安装其他工具来获取 那就是使用 libimobiledevice ...
- UserAgent和获取手机内安装的所有app列表
获取手机内安装的所有app列表 注意: 获取收集所有app的信息,很耗时,需要在子线程中执行 1.新建两个实体类 BaseBean和ListAppBean import android.text.Te ...
- 获取Android手机已安装应用程序的安装包
手把手教你获取Android手机已安装应用程序的安装包 前言: 某天临时访问了一个网址然后下载了一个APP,过了一段时间想要将这个APP安装在其他手机上面或者是介绍给其他小伙伴安装的时候发现该应用在应 ...
- 获取android已安装的应用PackageInfo启动第三方APP应用
获取android已安装的应用PackageInfo 获取已安装的应用 public static ArrayList<AppInfo> getInstalledApps(Context ...
- 小米手机 已安装了存在签名冲突的应用
小米手机 已安装了存在签名冲突的应用 在小米手机上安装软件有时候会出现已安装了相同签名的应用,但是实际上手机怎么也找不到相同的应用,也没有安装相同的debug版本.最后才发现是小米手机分身的问题. 如 ...
最新文章
- 掌握JAVA多线程的利器-线程池
- 正则表达式 perl
- Kafka 副本OffsetOutOfRangeException
- The type android.support.v4.view.ScrollingView cannot be resolved. It is indirectly referenced from
- Max Sum Plus Plus HDU - 1024
- 远离ARP*** ARP防火墙新版发布
- Laravel核心解读--控制器 1
- 【报告分享】2020年中国数据驱动型企业成长路径研究报告.pdf(附下载链接)...
- [解读REST] 6.REST的应用经验以及教训
- 利用百度搜索结果爬取邮箱
- 计算机中if函数的使用方法,excelif函数多层嵌套的使用方法
- x*=3+5**2的计算结果python_下面代码的执行结果是________ x = 2 x *= 3 + 5**2
- oracle-linux系统下载
- HINSTANCE+hPreInstance
- 微信ipad协议稳定版826的底层逻辑
- VERSAL ACAP在线升级
- Matlab之将非严格占优矩阵化为严格占优矩阵
- Red Hat Enterprise Linux5使用光盘镜像文件安装gcc软件包流程
- 张曼玉 杨思敏 陈慧琳等众多明星成为亚洲交友代言人
- 收集那些一生难忘的记忆片段