13

How to get list of all installed Applications on iPhone device programmatically in iOS 8.

If anyone knows the solution by using private APIs(but device non-jailbroken) then its well and good.

I know that it is possible using iTunes Search API, but it gives only those applications that are installed from iTunes. I need all the applications on device, whether it is from iTunes or user-developed or system apps.

Mehul Thakkar
  • 12,440
  • 10
  • 52
  • 81

2 Answers2

21

try this. it works,I've tested.

#include <objc/runtime.h>
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSLog(@"apps: %@", [workspace performSelector:@selector(allApplications)]);
Roxasora
  • 223
  • 2
  • 6
  • Is there any way of making this provide just a list of app identifiers? As a array or something like that? – Ali Clarke Mar 10 '15 at 11:21
  • @AliClarke As far as I know there isn't a such way, we can only get bundle id from the solution above :) – Roxasora Apr 17 '15 at 08:28
  • @RaduVlad Bro, this is indeed a private API, it could only be used in a demo or an enterprise deployment. – Roxasora Apr 17 '15 at 08:30
  • Is there any public way to get the availability of a list of applications? I tried iHasApp but I couldn't find all my list there. – Radu Vlad Apr 17 '15 at 09:25
  • 1
    @RaduVlad the "iHasApp" is the "App Store safe" way to detect installed apps, and if you can not find all your list, maybe you could "curate your own dataset(in his github readme)". As I know, iHasApp used 2 ways to get installed apps list: first is "canOpenUrl()",that means apps that registered a custom URL will be found; second is checking "process name" of running apps, that means apps that you don't run frequently won't be found. Wish these infomations could be helpful :) – Roxasora Apr 20 '15 at 05:24
  • I think Whatsapp is one of the apps most frequently found, but iHasApp cannot recognise it. The problem is probably that the list is pretty old. – Radu Vlad Apr 20 '15 at 08:35
  • @RaduVlad I'm afraid not,actually iHasApp updated scheme list 2 months ago(https://github.com/danielamitay/iHasApp/blob/master/iHasApp/schemeApps.json), you can check this page and there is whatsapp...so...is there any possibility that you may use iHasApp library in a wrong way? – Roxasora Apr 20 '15 at 12:13
  • I'm using the code used in their example, and for with success I'm printing the dictionary with for(int i = 0; i < appDictionaries.count; i++){ NSDictionary *currentDict = appDictionaries[i]; NSLog(@"%@", [currentDict objectForKey:@"bundleId"]); } – Radu Vlad Apr 20 '15 at 13:03
  • Ok....i found the issue I had. The problem was that i was using the released version 2.2 of iHasApp from CocoaPods, but that was an old version. Just updated with the master and it recognised whatsapp aswel. Thanks a lot. – Radu Vlad Apr 20 '15 at 13:23
  • I managed to perform exactly the tasks i needed using the private frameworks (get list of bundle ids & get the data path & shared locaton for each) , cheers for the help – Ali Clarke Apr 23 '15 at 09:09
  • 1
    Hi guys, What about iOS9? Is there any way to get the list of installed or running apps? – Dmitry Isakov Sep 23 '15 at 09:20
  • 1
    @DmitryIsakov Man,you could look at the ios-runtime-headers [link](https://github.com/nst/iOS-Runtime-Headers),if there still have a LSApplicationWorkspace class, then you may use the solution above to get installed apps in the same way. And if you want to get running apps...I know a old way but I didn't try on iOS9, you can give me your email and I'll send the main function to you:D – Roxasora Sep 24 '15 at 06:07
  • @Roxasora, I did answer your email. Have you seen my letter? – Dmitry Isakov Sep 25 '15 at 04:50
  • The snippet doesn't appear to work on an jailbroken iOS 8.4 phone. That snippet exactly just prints null – Gdogg Sep 28 '15 at 18:33
  • 1
    This is private api and using it will cause for app rejection from apple. Their is no such way from apple to fetch list of installed apps. – Mohit kumar Mar 08 '16 at 08:57
  • @JoshuaDance not any more – Roxasora Apr 25 '17 at 08:24
  • all solution with "LSApplicationWorkspace" will not work from ios11 onwards – Naveen Murthy Sep 21 '17 at 10:58
  • But is there a possible solution that works on newer devices - even with an private API? – Mr.Gosh Aug 17 '21 at 10:28
6

I refactored above code for Xcode 7.3. It is working perfectly fine on iOS9.

 #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]);
Stalin Pusparaj
  • 741
  • 9
  • 11