代码
#include <objc/runtime.h>
- (void)testBundleID
{
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray *apps = [workspace performSelector:@selector(allApplications)];
for (id oneApp in apps) {
// NSString *itemName = [oneApp valueForKey:@"itemName"];
NSString *localizedName = [oneApp valueForKey:@"localizedName"];
NSString *vendorName = [oneApp valueForKey:@"vendorName"];
NSString *shortVersionString = [oneApp valueForKey:@"shortVersionString"];
NSString *minimumSystemVersion = [oneApp valueForKey:@"minimumSystemVersion"];
NSString *applicationIdentifier = [oneApp valueForKey:@"applicationIdentifier"];
NSLog(@">>>>\n 名称:%@(v%@) \n BundleID:<%@> \n 最低版本:%@ \n 开发商: %@", localizedName, shortVersionString, applicationIdentifier, minimumSystemVersion, vendorName);
}
}
头文件
https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/MobileCoreServices.framework/LSApplicationProxy.h
@interface LSApplicationProxy : LSBundleProxy <NSSecureCoding> {
NSArray * _activityTypes;
_LSApplicationState * _appState;
NSString * _applicationVariant;
long _bundleModTime;
NSString * _companionApplicationIdentifier;
NSString * _complicationPrincipalClass;
NSArray * _deviceFamily;
NSString * _deviceIdentifierVendorName;
_LSDiskUsage * _diskUsage;
NSNumber * _downloaderDSID;
NSNumber * _familyID;
NSString * _genre;
NSNumber * _genreID;
unsigned int _installType;
NSNumber * _itemID;
NSString * _itemName;
NSString * _minimumSystemVersion;
unsigned int _originalInstallType;
NSArray * _plugInKitPlugins;
NSArray * _pluginUUIDs;
NSString * _preferredArchitecture;
NSArray * _privateDocumentIconNames;
LSApplicationProxy * _privateDocumentTypeOwner;
NSNumber * _purchaserDSID;
NSString * _ratingLabel;
NSNumber * _ratingRank;
NSDate * _registeredDate;
NSString * _sdkVersion;
NSString * _shortVersionString;
NSString * _sourceAppIdentifier;
NSNumber * _storeFront;
NSArray * _supportedComplicationFamilies;
NSString * _teamID;
BOOL _userInitiatedUninstall;
NSString * _vendorName;
NSNumber * _versionID;
NSString * _watchKitVersion;
}
@property (nonatomic, readonly) NSNumber *ODRDiskUsage;
@property (nonatomic, readonly) NSArray *UIBackgroundModes;
@property (nonatomic, readonly) NSArray *VPNPlugins;
@property (nonatomic, readonly) NSArray *activityTypes;
@property (nonatomic, readonly) _LSApplicationState *appState;
@property (nonatomic, readonly) NSArray *appTags;
@property (nonatomic, readonly) NSString *applicationDSID;
@property (nonatomic, readonly) NSString *applicationIdentifier;
@property (nonatomic, readonly) NSString *applicationType;
@property (nonatomic, readonly) NSString *applicationVariant;
@property (nonatomic, readonly) NSArray *audioComponents;
@property (nonatomic, readonly) NSNumber *betaExternalVersionIdentifier;
@property (nonatomic, readonly) long bundleModTime;
@property (nonatomic, readonly) NSString *companionApplicationIdentifier;
@property (readonly) NSString *complicationPrincipalClass;
@property (nonatomic, readonly) NSArray *deviceFamily;
@property (nonatomic, readonly) NSUUID *deviceIdentifierForAdvertising;
@property (nonatomic, readonly) NSUUID *deviceIdentifierForVendor;
@property (nonatomic, readonly) NSArray *directionsModes;
@property (nonatomic, readonly) _LSDiskUsage *diskUsage;
@property (nonatomic, readonly) NSNumber *downloaderDSID;
@property (nonatomic, readonly) NSNumber *dynamicDiskUsage;
@property (nonatomic, readonly) NSArray *externalAccessoryProtocols;
@property (nonatomic, readonly) NSNumber *externalVersionIdentifier;
@property (nonatomic, readonly) NSNumber *familyID;
@property (nonatomic, readonly) BOOL fileSharingEnabled;
@property (getter=isGameCenterEnabled, nonatomic, readonly) BOOL gameCenterEnabled;
@property (nonatomic, readonly) BOOL gameCenterEverEnabled;
@property (nonatomic, readonly) NSString *genre;
@property (nonatomic, readonly) NSNumber *genreID;
@property (readonly) BOOL hasComplication;
@property (nonatomic, readonly) BOOL hasCustomNotification;
@property (nonatomic, readonly) BOOL hasGlance;
@property (nonatomic, readonly) BOOL hasMIDBasedSINF;
@property (nonatomic, readonly) BOOL hasSettingsBundle;
@property (nonatomic, readonly) BOOL iconIsPrerendered;
@property (nonatomic, readonly) NSProgress *installProgress;
@property (nonatomic, readonly) unsigned int installType;
@property (nonatomic, readonly) BOOL isAdHocCodeSigned;
@property (nonatomic, readonly) BOOL isAppUpdate;
@property (nonatomic, readonly) BOOL isBetaApp;
@property (nonatomic, readonly) BOOL isInstalled;
@property (nonatomic, readonly) BOOL isLaunchProhibited;
@property (nonatomic, readonly) BOOL isNewsstandApp;
@property (nonatomic, readonly) BOOL isPlaceholder;
@property (nonatomic, readonly) BOOL isPurchasedReDownload;
@property (nonatomic, readonly) BOOL isRestricted;
@property (nonatomic, readonly) BOOL isStickerProvider;
@property (nonatomic, readonly) BOOL isWatchKitApp;
@property (nonatomic, readonly) NSNumber *itemID;
@property (nonatomic, readonly) NSString *itemName;
@property (nonatomic, readonly) NSString *minimumSystemVersion;
@property (nonatomic, readonly) BOOL missingRequiredSINF;
@property (nonatomic, readonly) unsigned int originalInstallType;
@property (nonatomic, readonly) NSArray *plugInKitPlugins;
@property (nonatomic, readonly) NSString *preferredArchitecture;
@property (nonatomic, copy) NSArray *privateDocumentIconNames;
@property (nonatomic, retain) LSApplicationProxy *privateDocumentTypeOwner;
@property (nonatomic, readonly) NSNumber *purchaserDSID;
@property (nonatomic, readonly) NSString *ratingLabel;
@property (nonatomic, readonly) NSNumber *ratingRank;
@property (nonatomic, readonly) NSDate *registeredDate;
@property (getter=isRemoveableSystemApp, nonatomic, readonly) BOOL removeableSystemApp;
@property (getter=isRemovedSystemApp, nonatomic, readonly) BOOL removedSystemApp;
@property (nonatomic, readonly) NSArray *requiredDeviceCapabilities;
@property (nonatomic, readonly) NSString *sdkVersion;
@property (nonatomic, readonly) NSString *shortVersionString;
@property (nonatomic, readonly) BOOL shouldSkipWatchAppInstall;
@property (nonatomic, readonly) NSString *sourceAppIdentifier;
@property (nonatomic, readonly) NSNumber *staticDiskUsage;
@property (nonatomic, readonly) NSArray *staticShortcutItems;
@property (nonatomic, readonly) NSString *storeCohortMetadata;
@property (nonatomic, readonly) NSNumber *storeFront;
@property (nonatomic, readonly) NSArray *subgenres;
@property (readonly) NSArray *supportedComplicationFamilies;
@property (nonatomic, readonly) BOOL supportsAudiobooks;
@property (nonatomic, readonly) BOOL supportsExternallyPlayableContent;
@property (nonatomic, readonly) BOOL supportsODR;
@property (nonatomic, readonly) BOOL supportsOpenInPlace;
@property (nonatomic, readonly) BOOL supportsPurgeableLocalStorage;
@property (nonatomic, readonly) NSString *teamID;
@property (nonatomic) BOOL userInitiatedUninstall;
@property (nonatomic, readonly) NSString *vendorName;
@property (nonatomic, readonly) NSString *watchKitVersion;
@property (getter=isWhitelisted, nonatomic, readonly) BOOL whitelisted;
。。。