Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of installed apps on iPhone

Is there a way (some API) to get the list of installed apps on an iPhone device.

While searching for similar questions, I found some thing related to url registration, but I think there must be some API to do this, as I don't want to do any thing with the app, I just want the list.

like image 562
Vikram.exe Avatar asked Jan 06 '11 10:01

Vikram.exe


4 Answers

You could do this by using the following:

 Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
 SEL selector = NSSelectorFromString(@"defaultWorkspace");

 NSObject* workspace = [LSApplicationWorkspace_class performSelector:selector];

 SEL selectorALL = NSSelectorFromString(@"allApplications");

 NSMutableArray *Allapps = [workspace performSelector:selectorALL];

 NSLog(@"apps: %@", Allapps);

And then by accessing each element and splitting it you can get your app name, and even the Bundle Identifier, too.

like image 62
Apple_Developer Avatar answered Oct 29 '22 12:10

Apple_Developer


for non jailbroken device, we can use third party framework which is called "ihaspp", also its free and apple accepted. Also they given good documentation how to integrate and how to use. May be this would be helpful to you. Good luck!!

https://github.com/danielamitay/iHasApp

like image 39
Anilkumar iOS - ReactNative Avatar answered Nov 20 '22 19:11

Anilkumar iOS - ReactNative


No, apps are sandboxed and Apple-accepted APIs do not include anything that would let you do that.

You can, however, test whether a certain app is installed:

  • if the app is known to handle URLs of a certain type
  • by using [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"thisapp://foo"]

You can get a list of apps and URL schemes from here.

like image 17
F'x Avatar answered Nov 20 '22 17:11

F'x


For jailbroken devices you can use next snipped of code:

-(void)appInstalledList
{
 static NSString* const path = @"/private/var/mobile/Library/Caches/com.apple.mobile.installation.plist";

NSDictionary *cacheDict = nil;
BOOL isDir = NO;
if ([[NSFileManager defaultManager] fileExistsAtPath: path isDirectory: &isDir] && !isDir) 
{
    cacheDict = [NSDictionary dictionaryWithContentsOfFile: path];

    NSDictionary *system = [cacheDict objectForKey: @"System"]; // First check all system (jailbroken) apps
    for (NSString *key in system)
    {
        NSLog(@"%@",key);
    }
    NSDictionary *user = [cacheDict objectForKey: @"User"]; // Then all the user (App Store /var/mobile/Applications) apps

    for (NSString *key in user)
    {
        NSLog(@"%@",key);
    }
    return;
}
NSLog(@"can not find installed app plist");                   
}
like image 4
Igor Avatar answered Nov 20 '22 18:11

Igor