Finding list of installed apps on iphone
Asked Answered
I

7

16

Is it possible to programatically find out name of all apps installed on my iOS device ? Is there any API available for same ?

Thanks for the help

Illustrative answered 6/1, 2011 at 12:2 Comment(0)
B
13

No, on iOS applications has no access to information of/about other applications due to sandboxed environment.

Brandi answered 6/1, 2011 at 12:5 Comment(4)
I found one working solution, not sure it will be accepted by apple !!! thoughts ???Illustrative
here is the link : iphonedevsdk.com/forum/iphone-sdk-development/…Illustrative
Yes, that file is accessible for reading for mobile user, however Apple can (and will, if found) reject such application because app can access only it's own sandbox, and other files must be accessed only via public SDKBrandi
you can use it for iphone enterprise version and not surely on appstore.Krein
T
4

Yes it is possible to get list of all installed app

-(void) allInstalledApp
{    
    NSDictionary *cacheDict;

    NSDictionary *user;

    static NSString *const cacheFileName = @"com.apple.mobile.installation.plist";

    NSString *relativeCachePath = [[@"Library" stringByAppendingPathComponent: @"Caches"] stringByAppendingPathComponent: cacheFileName];

    NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent: @"../.."] stringByAppendingPathComponent: relativeCachePath];

    cacheDict    = [NSDictionary dictionaryWithContentsOfFile: path];

    user = [cacheDict objectForKey: @"User"];

    NSDictionary *systemApp=[cacheDict objectForKey:@"System"];
}   

systemApp Dictionary contains the list of all system related app and user Dictionary contains other app information.

Thanh answered 14/5, 2013 at 11:11 Comment(4)
does this also gives the list of developer apps ?Contumely
this does not work for me also. getting response nil. please suggestTrader
This is only working for Jailbroken device, not working for non-jailbroken device, for non-jailbroken device it returns nilGlisten
Check this link github.com/danielamitay/iHasApp, Document Link ihasapp.com/documentation/Classes/iHasApp.htmlThanh
E
2

Not from the device. However, from the desktop you could peek into the iTunes library.

Estragon answered 6/1, 2011 at 14:45 Comment(1)
are you talking about doing it programatically ? If yes, can you give more details?Platelet
E
2

There are ways to do this without a jailbroken device and not get your app rejected.
1. get a list of currently running processes see this SO answer. You will need to translate from process name to app name.
2. Check to see if any apps have registered a unique URL scheme with UIApplicationDelegate canOpenURL. There are a few sites cataloging known url schemes, this is the best one.

If an app is not currently running and does not register a custom url scheme then it will not be detected by these methods. I am interested in hearing a method that will be allowed in the app store that works better than this.

Eiland answered 2/10, 2012 at 22:56 Comment(0)
O
1

try this, it will work even with non-jailbroken devices:

#include <objc/runtime.h>
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
SEL selector=NSSelectorFromString(@"defaultWorkspace");

NSObject* workspace = [LSApplicationWorkspace_class performSelector:selector];

SEL selectorALL = NSSelectorFromString(@"allApplications");

NSLog(@"apps: %@", [workspace performSelector:selectorALL]);//will give you all **Bundle IDS** of user's all installed apps
Odyssey answered 28/7, 2016 at 13:6 Comment(4)
how to parse app name and bundle id from this? please help meMelvin
@VikashRajput My answer is 100% tested. You will get all apps(i.e. Bundle IDs) in the last line of above code, But you cannot overwrite anything due to sandboxing. However, you can google for it. If it was helpful to you then there should be an upvote :) .Odyssey
It will gives an array of LSApplicationProxy type objects but i am not able to get bundle id as NSString. Can you please parse bundle id as NSString?Melvin
[workspace performSelector:selectorALL] objectAtIndexPath:0]; print this you will get first index, then using this use a for loop and separate into stringOdyssey
D
0

You can do it by checking whether an application is installed or not by using canOpenURL method or by checking the background processes and matching them with the name of the app you are interested in.

Drucilladrucy answered 20/2, 2014 at 7:3 Comment(0)
P
0

You can use runtime objective c to get the list of all installed apps. It will give you an array of LSApplicationProxy objects.

Following is a code snippet that prints Name of all applications installed in your device.

Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:NSSelectorFromString(@"defaultWorkspace")];
NSMutableArray *array = [workspace performSelector:NSSelectorFromString(@"allApplications")];

NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
for (id lsApplicationProxy in array) {
    if(nil != [lsApplicationProxy performSelector:NSSelectorFromString(@"itemName")]){
        [mutableArray addObject:[lsApplicationProxy performSelector:NSSelectorFromString(@"itemName")]];
    }
}
NSLog(@"********* Applications List ************* : \n %@",mutableArray);

Don't forget to include <objc/runtime.h> .

Petrel answered 8/7, 2017 at 13:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.