iOS 获取手机所安装的app应用信息

对于iPhone手机上安装的一些app信息,我们可以通过类LSApplicationWorkspace的方法来获取,但是在有些的系统版本会获取失败。

1、关于LSApplicationWorkspace.h文件:

/**
(
isApplicationAvailableToOpenURL:includePrivateURLSchemes:error:,
operationToOpenResource:usingApplication:uniqueDocumentIdentifier:isContentManaged:sourceAuditToken:userInfo:options:delegate:,
openUserActivityWithUUID:activityType:usingApplicationRecord:configuration:completionHandler:,
openApplicationWithBundleIdentifier:configuration:completionHandler:,
updatePlaceholderWithBundleIdentifier:withInstallType:error:,
installContainerizedApplicationArtifactAtURL:withOptions:error:progressBlock:,
_openUserActivity:orUserActivityUUID:activityTypeForUUID:withApplicationProxy:options:completionHandler:,
observerProxy,
updateRecordForApp:withSINF:iTunesMetadata:placeholderMetadata:sendNotification:error:,
installApplication:withOptions:error:usingBlock:,
updateSINFWithData:forApplication:options:error:,
ls_injectUTTypeWithDeclaration:inDatabase:error:,
removeAllDefaultApplicationPreferencesWithCompletionHandler:,
remoteObserver,
operationToOpenResource:usingApplication:uniqueDocumentIdentifier:sourceIsManaged:userInfo:options:delegate:,
_LSPrivateRebuildApplicationDatabasesForSystemApps:internal:user:,
openUserActivity:usingApplicationRecord:configuration:completionHandler:,
_getBundleIdentifierForBundleAtURL:invokeUpdateBlockAndReregister:error:,
downgradeApplicationToPlaceholder:withOptions:error:,
isApplicationAvailableToOpenURLCommon:includePrivateURLSchemes:error:,
registerApplicationDictionary:withObserverNotification:,
installProgressForBundleID:makeSynchronous:,
pluginsWithIdentifiers:protocols:version:applyFilter:,
registerPlugin:,
updateiTunesMetadataWithData:forApplicationAtURL:error:,
removeDeviceIdentifierForVendorName:bundleIdentifier:,
relaxApplicationTypeRequirements:forApplicationRecord:completionHandler:,
operationToOpenResource:usingApplication:uniqueDocumentIdentifier:userInfo:delegate:,
scanForApplicationStateChangesFromRank:toRank:,
syncObserverProxy,
updateiTunesMetadataWithData:forApplication:options:error:,
unregisterPlugin:,
privateURLSchemes,
installedPlugins,
applicationForUserActivityDomainName:,
rebuildDatabaseContentForFrameworkAtURL:completionHandler:,
enumerateApplicationsOfType:legacySPI:block:,
operationToOpenResource:usingApplication:uniqueDocumentIdentifier:userInfo:,
enumerateApplicationsOfType:block:,
bundleIdentifiersForMachOUUIDs:error:,
machOUUIDsForBundleIdentifiers:error:,
installApplication:withOptions:error:,
ls_testWithCleanDatabaseWithError:,
publicURLSchemes,
updatePlaceholderMetadataForApp:installType:failure:underlyingError:source:outError:,
installProgressForApplication:withPhase:,
establishConnection,
enumerateBundlesOfType:usingBlock:,
applicationsWithUIBackgroundModes,
placeholderInstalledForIdentifier:filterDowngrades:,
applicationsOfType:,
uninstallApplication:withOptions:error:usingBlock:,
pluginsMatchingQuery:applyFilter:,
_LSPrivateRemovedSystemAppIdentifiers,
uninstallContainerizedApplicationWithIdentifier:options:error:progressBlock:,
createdInstallProgresses,
legacyApplicationProxiesListWithType:,
setDefaultWebBrowserToApplicationRecord:completionHandler:,
uninstallApplication:withOptions:,
createDeviceIdentifierWithVendorName:bundleIdentifier:,
openURL:configuration:completionHandler:,
openURL:withOptions:,
uninstallApplication:withOptions:usingBlock:,
setDefaultMailClientToApplicationRecord:completionHandler:,
operationToOpenResource:usingApplication:userInfo:,
registerApplication:,
enumeratePluginsMatchingQuery:withBlock:,
sendApplicationStateChangedNotificationsFor:,
applicationsAvailableForOpeningDocument:,
deviceIdentifierForVendorSeedData,
unrestrictedApplications,
scanForApplicationStateChangesWithWhitelist:,
_LSPrivateSetRemovedSystemAppIdentifiers:,
invalidateIconCache:,
pluginsWithIdentifiers:protocols:version:,
openURL:withOptions:error:,
openSensitiveURL:withOptions:error:,
_LSClearSchemaCaches,
applicationProxiesWithPlistFlags:bundleFlags:,
operationToOpenResource:usingApplication:uniqueDocumentIdentifier:sourceIsManaged:userInfo:delegate:,
pluginsWithIdentifiers:protocols:version:withFilter:,
installPhaseFinishedForProgress:,
openUserActivity:withApplicationProxy:options:completionHandler:,
updateSINFWithData:forApplicationAtURL:error:,
applicationsWithVPNPlugins,
clearAdvertisingIdentifier,
optionsFromOpenConfiguration:,
openUserActivity:withApplicationProxy:completionHandler:,
getKnowledgeUUID:andSequenceNumber:,
applicationsAvailableForOpeningURL:legacySPI:,
enumerateBundlesOfType:block:,
applicationsAvailableForOpeningURL:,
_LSPrivateSyncWithMobileInstallation,
openSensitiveURL:withOptions:,
scanForForDeletableSystemApps,
enumerateBundlesOfType:legacySPI:block:,
openApplicationWithBundleID:,
clearCreatedProgressForBundleID:,
getClaimedActivityTypes:domains:,
directionsApplications,
unregisterApplication:,
initiateProgressForApp:withType:,
applicationsForUserActivityType:limit:,
isVersion:greaterThanOrEqualToVersion:,
_LSPrivateUpdateAppRemovalRestrictions,
isApplicationAvailableToOpenURL:error:,
garbageCollectDatabaseWithError:,
applicationForUserActivityType:,
removedSystemApplications,
restoreSystemApplication:,
applicationsWithAudioComponents,
installApplication:withOptions:,
deviceIdentifierForVendor,
ls_resetTestingDatabase,
applicationsForUserActivityType:,
placeholderApplications,
observedInstallProgresses,
_LSFailedToOpenURL:withBundle:,
URLOverrideForURL:,
registerApplicationDictionary:,
deviceIdentifierForAdvertising,
_LSPrivateDatabaseNeedsRebuild,
applicationForOpeningResource:,
URLOverrideForNewsURL:,
applicationsAvailableForHandlingURLScheme:,
removeObserver:,
.cxx_destruct,
openURL:,
addObserver:,
allowsAlternateIcons,
applicationIsInstalled:,
allApplications,
allInstalledApplications
)
*/
@interface LSApplicationWorkspace : NSObject {

}
+ (id)defaultWorkspace;

 - (BOOL)establishConnection;
 - (id)remoteObserver;
 - (id)pluginsWithIdentifiers:(id)a protocols:(id)b version:(id)c applyFilter:(@?)d ;
 - (BOOL)applicationIsInstalled:(id)a ;
 - (BOOL)openURL:(id)a withOptions:(id)b ;
 - (id)operationToOpenResource:(id)a usingApplication:(id)b uniqueDocumentIdentifier:(id)c sourceIsManaged:(BOOL)d userInfo:(id)e delegate:(id)f ;
 - (id)operationToOpenResource:(id)a usingApplication:(id)b uniqueDocumentIdentifier:(id)c userInfo:(id)d delegate:(id)e ;
 - (id)operationToOpenResource:(id)a usingApplication:(id)b uniqueDocumentIdentifier:(id)c userInfo:(id)d ;
 - (BOOL)installApplication:(id)a withOptions:(id)b error:(^@)c usingBlock:(@?)d ;
 - (id) installProgressForApplication:(id)a withPhase:(unsigned long long)b ;
 - (BOOL)uninstallApplication:(id)a withOptions:(id)b usingBlock:(@?)c ;
 - (BOOL)registerApplicationDictionary:(id)a withObserverNotification:(unsigned long long)b ;
 - (BOOL)installPhaseFinishedForProgress:(id)a ;
 - (void)clearCreatedProgressForBundleID:(id)a ;
 - (void)removeInstallProgressForBundleID:(id)a ;
 - (void)getKnowledgeUUID:(^@)a andSequenceNumber:(^@)b ;
 - (id)delegateProxy;
 - (id)applicationForOpeningResource:(id)a ;
 - (id)directionsApplications;
 - (id)applicationsWithUIBackgroundModes;
 - (id)applicationsWithSettingsBundle;
 - (id)applicationsWithVPNPlugins;
 - (id)applicationsWithExternalAccessoryProtocols;
 - (id)applicationForUserActivityType:(id)a ;
 - (id)applicationForUserActivityDomainName:(id)a ;
 - (id)applicationsOfType:(unsigned long long)a ;
 - (id)pluginsWithIdentifiers:(id)a protocols:(id)b version:(id)c withFilter:(@?)d ;
 - (id)pluginsWithIdentifiers:(id)a protocols:(id)b version:(id)c ;
 - (id)applicationsAvailableForOpeningDocument:(id)a ;
 - (id)applicationsAvailableForHandlingURLScheme:(id)a ;
 - (BOOL)openApplicationWithBundleID:(id)a ;
 - (id)operationToOpenResource:(id)a usingApplication:(id)b userInfo:(id)c ;
 - (void)enumerateBundlesOfType:(unsigned long long)a usingBlock:(@?)b ;
 - (id)installedVPNPlugins;
 - (id)installedPlugins;
 - (id)placeholderApplications;
 - (id)unrestrictedApplications;
 - (id)allApplications;
 - (id)publicURLSchemes;
 - (id)privateURLSchemes;
 - (BOOL)getClaimedActivityTypes:(^@)a domains:(^@)b ;
 - (BOOL)installApplication:(id)a withOptions:(id)b ;
 - (BOOL)installApplication:(id)a withOptions:(id)b error:(^@)c ;
 - (BOOL)uninstallApplication:(id)a withOptions:(id)b ;
 - (BOOL)registerApplicationDictionary:(id)a ;
 - (BOOL)registerApplication:(id)a ;
 - (BOOL)unregisterApplication:(id)a ;
 - (BOOL)registerPlugin:(id)a ;
 - (BOOL)unregisterPlugin:(id)a ;
 - (BOOL)updateSINFWithData:(id)a forApplication:(id)b options:(id)c error:(^@)d ;
 - (BOOL)invalidateIconCache:(id)a ;
 - (void)clearAdvertisingIdentifier;
 - (void)_clearCachedAdvertisingIdentifier;
 - (id)deviceIdentifierForAdvertising;
 - (id)deviceIdentifierForVendor;
 - (id)installProgressForBundleID:(id)a makeSynchronous:(unsigned char)b ;
 - (BOOL)_LSPrivateRebuildApplicationDatabasesForSystemApps:(BOOL)a internal:(BOOL)b user:(BOOL)c ;
 - (void)_LSClearSchemaCaches;
 - (id)URLOverrideForURL:(id)a ;
 - (BOOL)openURL:(id)a ;
 - (id)allInstalledApplications;
 - (void)removeObserver:(id)a ;
 - (void)addObserver:(id)a ;
 - (BOOL)openSensitiveURL:(id)a withOptions:(id)b ;
 - (id)applicationsWithAudioComponents;
@end

2、关于LSApplicationProxy.h文件

/**
(
__IS_iconDataForVariant:withOptions:,
__IS_iconDataForVariant:preferredIconName:withOptions:,
un_applicationBundleIdentifier,
un_applicationBundleURL,
if_userActivityTypes,
isInstalled,
genre,
genreID,
teamID,
detach,
bundleType,
installType,
downloaderDSID,
appIDPrefix,
ODRDiskUsage,
isAppUpdate,
deviceFamily,
supportsODR,
UPPValidated,
bundleModTime,
subgenres,
activityTypes,
isWatchKitApp,
registeredDate,
isNewsstandApp,
installProgress,
vendorName,
plugInKitPlugins,
isRestricted,
alternateIconName,
iconIsPrerendered,
claimedURLSchemes,
getBundleMetadata,
platform,
applicationDSID,
managedPersonas,
applicationType,
staticDiskUsage,
hasMIDBasedSINF,
originalInstallType,
storeCohortMetadata,
_managedPersonas,
dynamicDiskUsage,
profileValidated,
_initWithContext:bundleUnit:applicationRecord:bundleID:resolveAndDetach:,
missingRequiredSINF,
iconDataForVariant:,
getDeviceManagementPolicyWithCompletionHandler:,
installProgressSync,
_localizedNameWithPreferredLocalizations:useShortNameOnly:,
handlerRankOfClaimForContentType:,
localizedNameForContext:preferredLocalizations:,
siriActionDefinitionURLs,
dataContainerURL,
clearAdvertisingIdentifier,
localizedNameForContext:preferredLocalizations:useShortNameOnly:,
localizedNameForContext:,
groupContainerURLs,
complicationPrincipalClass,
primaryIconDataForVariant:,
applicationVariant,
_initWithBundleUnit:context:bundleIdentifier:,
fileSharingEnabled,
_usesSystemPersona,
setUserInitiatedUninstall:,
iconUsesAssetCatalog,
installFailureReason,
isStandaloneWatchApp,
freeProfileValidated,
preferredArchitecture,
betaExternalVersionIdentifier,
claimedDocumentContentTypes,
setAlternateIconName:withResult:,
isPurchasedReDownload,
isRemoveableSystemApp,
gameCenterEverEnabled,
deviceManagementPolicy,
isDeletableIgnoringRestrictions,
getGenericTranslocationTargetURL:error:,
userInitiatedUninstall,
isWhitelisted,
forwardingTargetForSelector:,
iconDataForVariant:withOptions:,
externalVersionIdentifier,
methodSignatureForSelector:,
correspondingApplicationRecord,
requiredDeviceCapabilities,
storeFront,
isPlaceholder,
applicationIdentifier,
.cxx_destruct,
familyID,
itemID,
appState,
itemName,
isDeviceBasedVPP,
valueForUndefinedKey:,
sourceAppIdentifier,
isRemovedSystemApp,
ratingRank,
environmentVariables,
respondsToSelector:,
companionApplicationIdentifier,
encodeWithCoder:,
isBetaApp,
initWithCoder:,
description,
purchaserDSID,
ratingLabel,
isGameCenterEnabled
)
*/
@interface LSApplicationProxy : LSResourceProxy  {
NSArray *_UIBackgroundModes;
NSString *_applicationType;
NSArray *_audioComponents;
unsigned int _bundleFlags;
NSURL *_bundleURL;
NSString *_bundleVersion;
NSArray *_directionsModes;
NSDictionary *_entitlements;
NSDictionary *_environmentVariables;
unsigned int _flags;
BOOL _foundBackingBundle;
NSDictionary *_groupContainers;
unsigned int _installType;
BOOL _isAppUpdate;
BOOL _isInstalled;
BOOL _isNewsstandApp;
BOOL _isPlaceholder;
BOOL _isRestricted;
NSArray *_machOUUIDs;
NSArray *_privateDocumentIconNames;
LSApplicationProxy *_privateDocumentTypeOwner;
BOOL _profileValidated;
NSString *_shortVersionString;
NSString *_signerIdentity;
NSString *_vendorID;
NSString *_vendorName;
}

@property(readonly) NSArray * UIBackgroundModes;
@property(readonly) BOOL _gkIsAppleInternal;
@property(readonly) BOOL _gkIsInstalled;
@property(readonly) NSString * applicationIdentifier;
@property(readonly) NSString * applicationType;
@property(readonly) NSArray * audioComponents;
@property(readonly) NSURL * bundleURL;
@property(readonly) NSString * bundleVersion;
@property(readonly) NSURL * containerURL;
@property(readonly) NSUUID * deviceIdentifierForVendor;
@property(readonly) NSArray * directionsModes;
@property(readonly) NSDictionary * entitlements;
@property(readonly) NSDictionary * environmentVariables;
@property(readonly) BOOL foundBackingBundle;
@property(readonly) NSDictionary * groupContainers;
@property(readonly) NSProgress * installProgress;
@property(readonly) unsigned int installType;
@property(readonly) BOOL isAppUpdate;
@property(readonly) BOOL isInstalled;
@property(readonly) BOOL isNewsstandApp;
@property(readonly) BOOL isPlaceholder;
@property(readonly) BOOL isRestricted;
@property(readonly) NSArray * machOUUIDs;
@property(readonly) BOOL profileValidated;
@property(readonly) NSString * roleIdentifier;
@property(readonly) NSString * shortVersionString;
@property(readonly) NSString * signerIdentity;
@property(readonly) NSString * vendorID;
@property(readonly) NSString * vendorName;

+ (id)_gkMetadataForBundleURL:(id)arg1;
+ (id)applicationProxyForIdentifier:(id)arg1 placeholder:(BOOL)arg2 server:(BOOL)arg3;
+ (id)applicationProxyForIdentifier:(id)arg1 placeholder:(BOOL)arg2;
+ (id)applicationProxyForIdentifier:(id)arg1 roleIdentifier:(id)arg2;
+ (id)applicationProxyForIdentifier:(id)arg1;
+ (BOOL)supportsSecureCoding;

- (id)UIBackgroundModes;
- (unsigned char)_createContext:(struct LSContext { struct LSDatabase {} *x1; }*)arg1 andGetBundle:(unsigned int*)arg2 withData:(const struct LSBundleData {}**)arg3;
- (struct CGSize { float x1; float x2; })_defaultStyleSize:(id)arg1;
- (id)_gkAdamID;
- (id)_gkBundle;
- (void)_gkDetachITunesMetadata;
- (id)_gkExternalVersion;
- (id)_gkGameDescriptor;
- (id)_gkITunesMetadata;
- (BOOL)_gkIsAppleInternal;
- (BOOL)_gkIsGameCenterEnabled;
- (BOOL)_gkIsGameCenterEverEnabled;
- (BOOL)_gkIsInstalled;
- (id)_gkItemName;
- (id)_gkPurchaseDate;
- (struct { int x1; struct CGSize { float x_2_1_1; float x_2_1_2; } x2; }*)_iconVariantDefinitions:(id)arg1;
- (id)_initWithApplicationIdentifier:(id)arg1 bundleType:(unsigned int)arg2 name:(id)arg3 containerURL:(id)arg4 resourcesDirectoryURL:(id)arg5 iconsDictionary:(id)arg6 iconFileNames:(id)arg7 iconIsPrerendered:(BOOL)arg8 server:(BOOL)arg9;
- (id)_plistValueForKey:(id)arg1;
- (id)applicationIdentifier;
- (id)applicationType;
- (id)audioComponents;
- (id)bundleURL;
- (id)bundleVersion;
- (id)containerURL;
- (void)dealloc;
- (id)description;
- (id)deviceIdentifierForVendor;
- (id)directionsModes;
- (void)encodeWithCoder:(id)arg1;
- (id)entitlements;
- (id)environmentVariables;
- (BOOL)foundBackingBundle;
- (id)groupContainers;
- (unsigned int)hash;
- (id)iconDataForVariant:(int)arg1;
- (id)iconStyleDomain;
- (id)initWithCoder:(id)arg1;
- (id)installProgress;
- (id)installProgressSync;
- (unsigned int)installType;
- (BOOL)isAppUpdate;
- (BOOL)isEqual:(id)arg1;
- (BOOL)isInstalled;
- (BOOL)isNewsstandApp;
- (BOOL)isPlaceholder;
- (BOOL)isRestricted;
- (id)localizedName;
- (id)machOUUIDs;
- (BOOL)privateDocumentIconAllowOverride;
- (id)privateDocumentIconNames;
- (id)privateDocumentTypeOwner;
- (BOOL)profileValidated;
- (id)resourcesDirectoryURL;
- (id)roleIdentifier;
- (void)setPrivateDocumentIconAllowOverride:(BOOL)arg1;
- (void)setPrivateDocumentIconNames:(id)arg1;
- (void)setPrivateDocumentTypeOwner:(id)arg1;
- (id)shortVersionString;
- (id)signerIdentity;
- (id)vendorID;
- (id)vendorName;
@end

3、通过类LSApplicationWorkspace获取信息

/// iOS12+
- (void)getAppInfoList {
    Class LSApplicationWorkspace = objc_getClass("LSApplicationWorkspace");
    Class LSApplicationProxy = objc_getClass("LSApplicationProxy");

    id defaultWorkspace = [LSApplicationWorkspace performSelector:@selector(defaultWorkspace)];
  
    // 此方法在iOS12+获取不到
//    id allApplications = [defaultWorkspace performSelector:@selector(allInstalledApplications)];
    NSArray *plugins = [defaultWorkspace performSelector:@selector(installedPlugins)];
    
    NSMutableSet *list = [[NSMutableSet alloc] init];
    for (id plugin in plugins) {
        id bundle = [plugin performSelector:@selector(containingBundle)];
        if (bundle) {
            [list addObject:bundle];
        }
    }

    // 遍历所有app信息
    for (id plugin in list) {
        // BundleID
        NSString *bundleIdentifier = [plugin performSelector:@selector(bundleIdentifier)];
        if (![bundleIdentifier containsString:@"com.apple"]) {
            NSLog(@"bundleIdentifier -> %@", bundleIdentifier);
        
        NSString *applicationDSID = [plugin performSelector:@selector(applicationDSID)];
        NSLog(@"applicationDSID -> %@", applicationDSID);

        NSString *applicationIdentifier = [plugin performSelector:@selector(applicationIdentifier)];
        NSLog(@"applicationIdentifier -> %@", applicationIdentifier);

        NSString *applicationType = [plugin performSelector:@selector(applicationType)];
        NSLog(@"applicationType -> %@", applicationType);

        NSString *dynamicDiskUsage = [plugin performSelector:@selector(dynamicDiskUsage)];
        NSLog(@"dynamicDiskUsage -> %@", dynamicDiskUsage);

        NSString *itemID = [plugin performSelector:@selector(itemID)];
        NSLog(@"itemID -> %@", itemID);

        NSString *itemName = [plugin performSelector:@selector(itemName)];
        NSLog(@"itemName -> %@", itemName);

        NSString *minimumSystemVersion = [plugin performSelector:@selector(minimumSystemVersion)];
        NSLog(@"minimumSystemVersion -> %@", minimumSystemVersion);

        NSString *requiredDeviceCapabilities = [plugin performSelector:@selector(requiredDeviceCapabilities)];
        NSLog(@"requiredDeviceCapabilities -> %@", requiredDeviceCapabilities);

        NSString *sdkVersion = [plugin performSelector:@selector(sdkVersion)];
        NSLog(@"sdkVersion -> %@", sdkVersion);

        NSString *shortVersionString = [plugin performSelector:@selector(shortVersionString)];
        NSLog(@"shortVersionString -> %@", shortVersionString);

        NSString *sourceAppIdentifier = [plugin performSelector:@selector(sourceAppIdentifier)];
        NSLog(@"sourceAppIdentifier -> %@", sourceAppIdentifier);

        NSString *staticDiskUsage = [plugin performSelector:@selector(staticDiskUsage)];
        NSLog(@"staticDiskUsage -> %@", staticDiskUsage);

        NSString *teamID = [plugin performSelector:@selector(teamID)];
        NSLog(@"teamID -> %@", teamID);

        NSString *vendorName = [plugin performSelector:@selector(vendorName)];
        NSLog(@"vendorName -> %@", vendorName);
        }
    }
}

/// iOS10 -12,判断是否安装app
- (BOOL)isAppInstalled:(NSString *)bundleId {
    NSBundle *container = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];
    if ([container load]) {
        Class appContainer = NSClassFromString(@"MCMAppContainer");
        
        id install = [appContainer performSelector:@selector(containerWithIdentifier:error:) withObject:bundleId];
        if (install) {
            return YES;
        }
    }
    return NO;
}

/// iOS10-
- (void)getAppInfoList10 {
    Class LSApplicationWorkspace = objc_getClass("LSApplicationWorkspace");
    NSObject* workspace = [LSApplicationWorkspace performSelector:@selector(defaultWorkspace)];
    NSArray *allApplications = [workspace performSelector:@selector(allApplications)];

    Class LSApplicationProxy = object_getClass(@"LSApplicationProxy");
    for (LSApplicationProxy in allApplications) {
        // 查看一些信息
        NSString *bundleID = [LSApplicationProxy performSelector:@selector(applicationIdentifier)];
        NSString *version =  [LSApplicationProxy performSelector:@selector(bundleVersion)];
        NSString *shortVersionString =  [LSApplicationProxy performSelector:@selector(shortVersionString)];
        
        NSLog(@"bundleID -> %@", bundleID);
    }
}

4、根据bundleID打开app

/// 直接打开某个APP
- (BOOL)isOpenApp:(NSString*)bundleIdentifier {
    Class LSApplicationWorkspace = objc_getClass("LSApplicationWorkspace");
    NSObject *workspace = [LSApplicationWorkspace performSelector:@selector(defaultWorkspace)];
    // 没有安装返回NO
    BOOL isOpenApp = [workspace performSelector:@selector(openApplicationWithBundleID:) withObject:bundleIdentifier];
    return isOpenApp;
}

你可能感兴趣的:(iOS 获取手机所安装的app应用信息)