iOS获取手机安装的所有应用信息(bundle id,icon,名称等)

读取app所有应用的信息,适用于iOS10以下,私有方法,app审核可能会被拒。

- (NSArray*)readApplications
{
	NSArray* allInstalledApplications = [_workspace allInstalledApplications];
	NSMutableArray* applications = [NSMutableArray arrayWithCapacity:allInstalledApplications.count];
	for(id proxy in allInstalledApplications)
	{
		LMApp* app = [LMApp appWithPrivateProxy:proxy];
		if(!app.isHiddenApp)
		{
			[applications addObject:app];
		}
	}
	
	return applications;
}

- (NSArray*)installedApplications
{
	if(nil == _installedApplications)
	{
		_installedApplications = [self readApplications];
	}
	
	return _installedApplications;
}

能获取到的信息有bundle ID,名称,icon,版本号等:

@interface LMApp : NSObject

@property (nonatomic, readonly) NSString* bundleIdentifier;
@property (nonatomic, readonly) NSString* name;
@property (nonatomic, readonly) UIImage* icon;

@property (nonatomic, readonly) NSString *applicationDSID;
@property (nonatomic, readonly) NSString *applicationIdentifier;
@property (nonatomic, readonly) NSString *applicationType;
@property (nonatomic, readonly) NSNumber *dynamicDiskUsage;

@property (nonatomic, readonly) NSArray *groupIdentifiers;
@property (nonatomic, readonly) NSNumber *itemID;
@property (nonatomic, readonly) NSString *itemName;
@property (nonatomic, readonly) NSString *minimumSystemVersion;
@property (nonatomic, readonly) NSArray *requiredDeviceCapabilities;
@property (nonatomic, readonly) NSString *roleIdentifier;
@property (nonatomic, readonly) NSString *sdkVersion;
@property (nonatomic, readonly) NSString *shortVersionString;
@property (nonatomic, readonly) NSString *sourceAppIdentifier;
@property (nonatomic, readonly) NSNumber *staticDiskUsage;
@property (nonatomic, readonly) NSString *teamID;
@property (nonatomic, readonly) NSString *vendorName;
demo下载: https://download.csdn.net/download/jueyi1127/10312681

你可能感兴趣的:(iOS开发)