zoukankan      html  css  js  c++  java
  • 利用私有的库MobileCoreServices检测正在安装的应用

      利用的私有库检测正在安装的app

    分为两步:第一,通过placeholderApplications获得所有的正在安装的app的信息

                  第二,遍历正在安装的app的信息,根据名称获得你想检测的app是否正在安装

    一旦使用了私有的接口你的app便不能再上架了

    利用私有的库MobileCoreServices检测正在安装的应用

        NSMutableArray *app = [NSMutableArray array];
        //获得私有的类
        Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
        NSObject *workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
        //获得所有的正在安装的app,得到的是个数组
        NSArray *apps = [workspace performSelector:@selector(placeholderApplications)];
        Class LSApplicationProxy_class = objc_getClass("LSApplicationProxy");
        //遍历数组,根据app的名称判断哪个app正在安装
        for (int i = 0; i < apps.count; i++) {
            NSObject *temp = apps[i];
            if ([temp isKindOfClass:LSApplicationProxy_class]) {
                NSString *appName = [temp performSelector:NSSelectorFromString(@"localizedName")];
                BOOL b  = [temp performSelector:NSSelectorFromString(@"isPlaceholder")];
                NSLog(@"名称:%@++++%d",appName,b);
            }
        }
  • 相关阅读:
    svn cleanup failed–previous operation has not finished 解决方法
    开源SNS社区系统推荐
    从网络获取图片本地保存
    MS SQL Server 数据库连接字符串
    KeepAlive
    Configure Git in debian
    sqlserver query time
    RPi Text to Speech (Speech Synthesis)
    SQL Joins with C# LINQ
    search or reseed identity columns in sqlserver 2008
  • 原文地址:https://www.cnblogs.com/liyy2015/p/6179623.html
Copyright © 2011-2022 走看看