Does LSApplicationWorkspace not work on iOS 11?

前端 未结 5 1328
抹茶落季
抹茶落季 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:43

    From this post. From the comment of @ovo under the original question, it seems works.

    Using MobileContainerManager.framework it's possible to check if an app is installed by using bundle id.

    //If the device is iOS11
        if ([[UIDevice currentDevice].systemVersion floatValue] >= 11.0) {
            NSBundle *container = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];
            if ([container load]) {
                Class appContainer = NSClassFromString(@"MCMAppContainer");
    
                id test = [appContainer performSelector:@selector(containerWithIdentifier:error:) withObject:bundleId withObject:nil];
                NSLog(@"%@",test);
                if (test) {
                    return YES;
                } else {
                    return NO;
                }
            }
            return NO;
    
        } else {
               //Usual way
        }
    

提交回复
热议问题