Reputation: 353
Many people use the Launcher app.
I'm curious about how Laucher be able to get the list of installed apps of my iPhone?
I have found some way to do similar thing, but all of them are not perfect.
1.use canOpenUrl:, this api requires a lot of url-schemes of apps.
2.search the plist file /private/var/mobile/Library/Caches/com.apple.mobile.installation.plist, which is not available in non-jailbreak iPhone. Also this plist file is not exist anymore in ios9.
3.search /Applications, which is not available in non-jailbreak iPhone.
Question is that, how can Launcher be able to search my iPhone and get the list of installed apps?
Upvotes: 1
Views: 1203
Reputation: 59
Recently I found out the solution using predefined Apple classes LSApplicationWorkspace_class and LSApplicationProxy we can achieve this.
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
for (LSApplicationProxy *apps in [workspace performSelector:@selector(allApplications)])
{
NSString *localizedName = apps.localizedName;
if([apps.applicationType isEqualToString:@"User"])
{
NSLog(@"\nlocalizedName: %@",localizedName);
NSLog(@"minimumSystemVersion: %@",apps.minimumSystemVersion);
NSLog(@"fileSharingEnabled: %d",apps.fileSharingEnabled);
NSLog(@"sdkVersion: %@",apps.sdkVersion);
}
}
Upvotes: 0
Reputation: 12668
So I downloaded Launcher into iTunes and had a look at its info.plist.
It turns out that it does what you first suggested, queries canOpenURL:
a lot of times to work out what you have installed.
Here is the contents of LSApplicationQuerySchemes
from version 1.3.6:
https://gist.github.com/liamnichols/53069b01da032498bd04
All 4561 of them
Upvotes: 5