2

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nandy
  • 51
  • 5

2 Answers2

3

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.
Bista
  • 7,869
  • 3
  • 27
  • 55
0

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

Community
  • 1
  • 1
Harrison Xi
  • 766
  • 1
  • 5
  • 23
  • You can do the same in iOS 9, but you have to "pre-declare" which schemes you will be using. – Avi Jan 18 '16 at 07:52