以编程方式列出iOS设备中安装的所有应用程序的版本 [英] List the Versions of all the applications installed in iOS device programmatically

查看:83
本文介绍了以编程方式列出iOS设备中安装的所有应用程序的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式获取未越狱的iOS设备的所有已安装应用程序的版本。
是否可以实现?

I need to get the Versions of all the installed applications programmatically for non-jailbroken iOS devices. Is it Possible to achieve this?

推荐答案

有可能,请尝试以下代码。

That's possible, please try the below code.

Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
    NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];

    for (LSApplicationProxy *apps in [workspace performSelector:@selector(allApplications)])
    {         
        NSString *localizedName = apps.localizedName;

        if([apps.applicationType isEqualToString:@"User"])
        {
            NSLog(@"\nlocalizedName: %@",localizedName);
            NSLog(@"minimumSystemVersion: %@",apps.minimumSystemVersion);
            NSLog(@"fileSharingEnabled: %d",apps.fileSharingEnabled);
            NSLog(@"sdkVersion: %@",apps.sdkVersion);
            NSLog(@"teamID: %@",apps.teamID);
        }
    }

为此,您需要在应用程序中放置4个类:

For this you need to place 4 classes in your app:

LSApplicationWorkspace, LSResourceProxy, LSBundleProxy, LSApplicationProxy.

这篇关于以编程方式列出iOS设备中安装的所有应用程序的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆