美文网首页
iOS - 获取手机安装的应用(iOS11以下)

iOS - 获取手机安装的应用(iOS11以下)

作者: 神灬渐入嘉靜 | 来源:发表于2019-04-02 10:56 被阅读0次

    获取手机安装的应用

    Class c =NSClassFromString(@"LSApplicationWorkspace");
    id s = [(id)c performSelector:NSSelectorFromString(@"defaultWorkspace")];
    NSArray *array = [s performSelector:NSSelectorFromString(@"allInstalledApplications")];
    for (id item in array)
    {
        NSLog(@"%@",[item performSelector:NSSelectorFromString(@"applicationIdentifier")]);
        //NSLog(@"%@",[item performSelector:NSSelectorFromString(@"bundleIdentifier")]);
        NSLog(@"%@",[item performSelector:NSSelectorFromString(@"bundleVersion")]);
        NSLog(@"%@",[item performSelector:NSSelectorFromString(@"shortVersionString")]);
    }
    

    iOS11以上版本无法再通过LSApplicationWorkspace获取到信息

    作者:iOS_小松哥
    链接:https://www.jianshu.com/p/4523eafb4cd4
    来源:简书
    简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

    相关文章

      网友评论

          本文标题:iOS - 获取手机安装的应用(iOS11以下)

          本文链接:https://www.haomeiwen.com/subject/ttuwbqtx.html