ios - 获取安装的应用程序列表及其在 iOS 中的使用情况

标签 ios iphone url-scheme

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

  1. 使用 IHasApp 框架,该框架仅返回具有 在其中使用了自定义 URL Scheme。其余的应用程序没有 实现自定义 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)框架来获取已安装的应用程序列表及其使用情况。

最佳答案

您可以使用 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/

相关文章:

ios - 使用自动布局独立切换两个内联项目的可见性

android - ModalBottomSheet中的tabBar具有动态大小的Flutter

iphone - iOS守护程序。他们对AppStore合法吗?

iphone - NSSearchPathForDirectoriesInDomains 麻烦(掉头发快)

ios - 如何从 iPhone 应用程序发送邮件

ios - 获取哪些 iOS 框架可用?

ios - 当其中的文本字段开始编辑时增加单元格的高度

html - 将 HTML 填充到大约 : URL with Chrome 中

android - 从 Android 应用程序打开 Facebook 页面?

objective-c - 从 URL 打开 iOS 应用程序并传递参数