List the Versions of all the applications installed in iOS device programmatically

女生的网名这么多〃 提交于 2019-12-12 10:01:49

问题


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


回答1:


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);
        }
    }

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

LSApplicationWorkspace, LSResourceProxy, LSBundleProxy, LSApplicationProxy.



回答2:


In iOS8 and before, we can use canOpenUrl to get installed applications which registered schemes. In iOS9, you must add a "white list" into your info.plist file. Only the application in the "white list" can be checked. And the limit count of the "white list" is 50. So you'd better jailbreak your device.

See more information: How to check particular app is already installed on iphone device or not?

Another one: http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html



来源:https://stackoverflow.com/questions/34849051/list-the-versions-of-all-the-applications-installed-in-ios-device-programmatical

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!