Reputation: 4585
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.
Upvotes: 12
Views: 18856
Reputation: 57
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.
Upvotes: 3
Reputation: 3755
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
Upvotes: 3
Reputation: 29
Well, not sure if this was available back when the last answer was given or not (Prior to iOS 6) Also this one is time intensive, yet simple: Go into settings > Gen. >usage. The first category under usage at least right now is Storage.
It will show a partial list of apps. At the bottom of this partial list is a button that says "show all apps". Tap that and you'll have to go through screen by screen, and take screenshots (Quick lock button and home button takes a screenshot). I'm doing this now and I have hundreds of apps on my iPhone. So it's going to take me a while. But at least at the end of the process I'll have Images of all my apps.
Upvotes: 2
Reputation: 4207
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");
}
Upvotes: 4
Reputation: 12298
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:
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"thisapp://foo"]
You can get a list of apps and URL schemes from here.
Upvotes: 17