在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 获取手机已安装应用列表相关推荐

  1. 获取计算机软件列表,获取计算机已安装软件列表解决方法

    获取计算机已安装软件列表 Dear all, 最近小弟在做一个应用程序,就是仿造360软件管家,获取计算机里已安装软件列表, 现思路如下,根据注册表路径: 针对x86系统,HKEY_LOCAL_MAC ...

  2. android 获取已安装列表权限,Android 如何完整的获取到用户已安装应用列表

    接到产品经理的预研需求,说希望获取用户已安装应用列表.这个问题应该不难,只要是要把相关的知识点整理和验证一下. 对于获取用户已安装应用列表,我个人是很熟悉的,因为我的华为手机上,手机管家天天会在通知栏 ...

  3. android 获取已安装 错误代码,android获取手机已经安装的app信息

    Android获取手机已安装APP(系统/非系统) 效果图 主体代码 private ListView mlistview; private ListpackageInfoList; private ...

  4. Android不同版本读取已安装应用列表权限相关问题

    转载自:https://blog.csdn.net/u010844304/article/details/111044338 如何在Android 11 上获取已安装应用列表在Android 11上, ...

  5. 如何获取IOS手机已安装app的bundleid

    获取IOS手机已安装app的bundleid 如果使用oc私有api获取不到ios11以上手机的app bundleid 那么可以使用安装其他工具来获取 那就是使用  libimobiledevice ...

  6. UserAgent和获取手机内安装的所有app列表

    获取手机内安装的所有app列表 注意: 获取收集所有app的信息,很耗时,需要在子线程中执行 1.新建两个实体类 BaseBean和ListAppBean import android.text.Te ...

  7. 获取Android手机已安装应用程序的安装包

    手把手教你获取Android手机已安装应用程序的安装包 前言: 某天临时访问了一个网址然后下载了一个APP,过了一段时间想要将这个APP安装在其他手机上面或者是介绍给其他小伙伴安装的时候发现该应用在应 ...

  8. 获取android已安装的应用PackageInfo启动第三方APP应用

    获取android已安装的应用PackageInfo 获取已安装的应用 public static ArrayList<AppInfo> getInstalledApps(Context ...

  9. 小米手机 已安装了存在签名冲突的应用

    小米手机 已安装了存在签名冲突的应用 在小米手机上安装软件有时候会出现已安装了相同签名的应用,但是实际上手机怎么也找不到相同的应用,也没有安装相同的debug版本.最后才发现是小米手机分身的问题. 如 ...

最新文章

  1. 掌握JAVA多线程的利器-线程池
  2. 正则表达式 perl
  3. Kafka 副本OffsetOutOfRangeException
  4. The type android.support.v4.view.ScrollingView cannot be resolved. It is indirectly referenced from
  5. Max Sum Plus Plus HDU - 1024
  6. 远离ARP*** ARP防火墙新版发布
  7. Laravel核心解读--控制器 1
  8. 【报告分享】2020年中国数据驱动型企业成长路径研究报告.pdf(附下载链接)...
  9. [解读REST] 6.REST的应用经验以及教训
  10. 利用百度搜索结果爬取邮箱
  11. 计算机中if函数的使用方法,excelif函数多层嵌套的使用方法
  12. x*=3+5**2的计算结果python_下面代码的执行结果是________ x = 2 x *= 3 + 5**2
  13. oracle-linux系统下载
  14. HINSTANCE+hPreInstance
  15. 微信ipad协议稳定版826的底层逻辑
  16. VERSAL ACAP在线升级
  17. Matlab之将非严格占优矩阵化为严格占优矩阵
  18. Red Hat Enterprise Linux5使用光盘镜像文件安装gcc软件包流程
  19. 张曼玉 杨思敏 陈慧琳等众多明星成为亚洲交友代言人
  20. 收集那些一生难忘的记忆片段

热门文章

  1. Contact Manager Web API 示例[1]CRUD 操作
  2. vrrp 理论和配置
  3. Python在数字前方补0
  4. 双11尾款人的续命丸哪里找?送3本精神食粮助你快速回血
  5. 12 java基础之继承:override(覆盖重写)
  6. 聚类分析:1.相似性测度
  7. 分布式资本合伙人孙铭:分布式存储是未来趋势,非短期炒作
  8. 算法稳定币项目Basis Cash将于2月7日启动V2迁移计划
  9. 未来金融科技宣布已完成mBTC系统和技术升级,消费者可用比特币进行在线支付
  10. SAP License:SAP系统界面相关调整和设置