Use private APIs to obtain information about all applications installed on your mobile phone (including version, name, bundleID, and type) and apibundleid

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.