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

Unicorn
  • 2,382
  • 6
  • 29
  • 42

7 Answers7

13

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

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48
  • I found one working solution, not sure it will be accepted by apple !!! thoughts ??? – Unicorn Jan 28 '11 at 11:06
  • 1
    here is the link : http://www.iphonedevsdk.com/forum/iphone-sdk-development/22289-possible-retrieve-these-information.html – Unicorn Jan 28 '11 at 12:20
  • 2
    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 SDK – Nickolay Olshevsky Jan 28 '11 at 13:04
  • you can use it for iphone enterprise version and not surely on appstore. – virata Dec 17 '12 at 06:51
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.

Vladimir
  • 9,683
  • 6
  • 36
  • 57
Avinash Kashyap
  • 861
  • 10
  • 16
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.

Community
  • 1
  • 1
Peter H
  • 608
  • 4
  • 12
2

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

joshpaul
  • 953
  • 8
  • 12
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
Anurag Sharma
  • 4,276
  • 2
  • 28
  • 44
  • how to parse app name and bundle id from this? please help me – Vikash Rajput Dec 02 '16 at 13:56
  • @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 :) . – Anurag Sharma Dec 04 '16 at 18:15
  • 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? – Vikash Rajput Dec 05 '16 at 05:48
  • 1
    [workspace performSelector:selectorALL] objectAtIndexPath:0]; print this you will get first index, then using this use a for loop and separate into string – Anurag Sharma Dec 06 '16 at 04:24
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.

Akshat Singhal
  • 1,801
  • 19
  • 20
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> .

abhinavroy23
  • 3,630
  • 1
  • 14
  • 19