OGeek|极客世界-中国程序员成长平台

标题: ios - 获取已安装应用列表及其在 iOS 中的使用情况 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 02:28
标题: ios - 获取已安装应用列表及其在 iOS 中的使用情况

我想获取已安装应用的列表及其在 iOS 设备上的使用情况。我已经搜索过这个并找到了一些解决方案。

  1. 使用 IHasApp 框架,该框架仅返回具有 在其中使用了自定义 URL 方案。其他没有的应用程序 未列出实现自定义 URL 方案。
  2. 我已经看到我们可以在 AppList 的帮助下得到结果 框架。但是没有说明如何使用该框架 我们的项目。 https://github.com/rpetrich/AppList
  3. 使用 SpringBoardServices 框架 - 为此我关注下面的链接,我从中得到的结果是正在运行的进程列表(pid、appid、pname 等)我不确定是否可以获得应用程序名称列表在这些信息的帮助下。 how to determine which apps are background and which app is foreground on iOS by application id
  4. 我尝试过的其他链接很少

    Getting global list of all ios apps

    https://stackoverflow.com/questions/2689711/itunes-app-store-api

    how to get the list of apps Name installed in the iPhone

    但没有任何帮助

如果您知道,请有人帮忙,我不介意使用私有(private)框架来获取安装的应用程序列表及其使用情况。



Best Answer-推荐答案


您可以使用 SpringboardServices 框架来完成。 首先下载这个框架的头文件并将框架链接到你的项目中,然后简单地实现这些代码行:

CFArrayRef SBSCopyApplicationDisplayIdentifiers(bool onlyActive, bool debuggable);

int main() {
    char buf[1024];
    CFArrayRef ary = SBSCopyApplicationDisplayIdentifiers(false, false);
    for(CFIndex i = 0; i < CFArrayGetCount(ary); i++) {
        CFStringGetCString(CFArrayGetValueAtIndex(ary, i),buf, sizeof(buf), kCFStringEncodingUTF8);
        printf("%s\n", buf);
    }
    return 0;
}

它将返回您设备中已安装应用的列表。但是,这些方法不能在 iOS 8 上运行,我现在仍在使用它。如果您知道 iOS 8 中的任何替代品,请分享。 我从这里找到的答案https://stackoverflow.com/a/15342129

关于ios - 获取已安装应用列表及其在 iOS 中的使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26174612/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4