Does LSApplicationWorkspace not work on iOS 11?

前端 未结 5 1280
抹茶落季
抹茶落季 2021-02-01 07:59

I have an app in private which need to scan all applications and schemes and get it by using private API LSApplicationWorkspace defaultWorkspace with others functio

5条回答
  •  盖世英雄少女心
    2021-02-01 08:55

    UPDATE: This method does not work on iOS 12 - entitlement required

    There is a way to find if a specific application is installed, its not a list of all apps like allInstalledApplications returned but its useful to query for a specific bundle id

    Here is an example, the method receives bundle id and return true if it's installed on the device:

    - (BOOL)checkIfAppInstalled: (NSString*)bundleID {
        dlopen("/System/Library/PrivateFrameworks/MobileContainerManager.framework/MobileContainerManager",RTLD_NOW);
        Class MBAppManager = NSClassFromString(@"MCMAppDataContainer");
        NSError  * error ;
        id contentApp = [MBAppManager performSelector:@selector(containerWithIdentifier:error:) withObject:bundleID withObject:error];
        return contentApp != nil;
    }
    

提交回复
热议问题