Use private APIs to obtain information about all applications installed on your mobile phone (including version, name, bundleID, and type) and apibundleid
MobileCoreService system library, which has a private class LSApplicationWorkspace
-(Id) allInstalledApplications; this method can obtain all application information on the device, including system and user applications.
The obtained application information is a Class Object LSApplicationProxy, which contains methods to obtain the app version, name, bundleID, Type
Okay, go directly to the code and first introduce the header file # include <objc/runtime. h>
-(Void) getAllApps {// obtain all app Class LSApplicationWorkspace_class = objc_getClass ("LSApplicationWorkspace"); NSObject * workspace = [LSApplicationWorkspace_class extends mselector: @ selector (defaultWorkspace)]; NSArray * apps = [workspace extends mselector: @ selector (allInstalledApplications)]; Class LSApplicationProxy_class = objc_getClass ("LSApplicationProxy"); for (int I = 0; I <apps. count; I ++) {NSObject * temp = apps [I]; if ([temp isKindOfClass: LSApplicationProxy_class]) {// application bundleId NSString * appBundleId = [temp callback mselector: NSSelectorFromString (@ "applicationIdentifier")]; // Application name NSString * appName = [temp parameter mselector: NSSelectorFromString (@ "localizedName")]; // whether the application type is a system application or a third-party application NSString * type = [temp restart mselector: NSSelectorFromString (@ "applicationType")]; // application version NSString * required versionstring = [temp required mselector: NSSelectorFromString (@ "required versionstring")]; NSLog (@ "type =%@ BundleId of the application =%++ Application name =%@ version = %@", type, appBundleId, appName, required versionstring );}}}
The header file https://github.com/nst/iOS-Runtime-Headers/tree/master/Frameworks/MobileCoreServices.framework in MobileCoreServices is attached here.