美文网首页
iOS - 获取手机上所有安装的app的bundle id

iOS - 获取手机上所有安装的app的bundle id

作者: 本僧先僧 | 来源:发表于2022-07-15 10:59 被阅读0次

    ##获取手机上所有安装的app的bundle id

    // 获取手机上所有安装的app的bundle id(iOS11无效) 

    - (NSArray*)getOtherAPPInfo{

        if(@available(iOS12.0, *)) {

            ClassLSApplicationWorkspace_Class =NSClassFromString(@"LSApplicationWorkspace");

            NSObject*workspace = [LSApplicationWorkspace_ClassperformSelector:NSSelectorFromString(@"defaultWorkspace")];

            NSArray *plugins = [workspace performSelector:NSSelectorFromString(@"installedPlugins")];

            for(idplugininplugins) {

                idbundle = [pluginperformSelector:NSSelectorFromString(@"containingBundle")];

                if(bundle) {

                    NSString *bundleid = [bundle performSelector:NSSelectorFromString(@"bundleIdentifier")];

                    NSString *itemName = [bundle performSelector:NSSelectorFromString(@"itemName")];

                    if(![bundleidcontainsString:@"com.apple."]) {

                        NSLog(@"*****  %@ <%@>  ****", [bundle performSelector:NSSelectorFromString(@"bundleIdentifier")], [bundle performSelector:NSSelectorFromString(@"itemName")]);

                    }

                }

            }

            returnplugins;

        }


        Class lsawsc = objc_getClass("LSApplicationWorkspace");

        NSObject* workspace = [lsawsc performSelector:NSSelectorFromString(@"defaultWorkspace")];

        NSArray *Arr = [workspace performSelector:NSSelectorFromString(@"allApplications")];

        for(NSString* tmpinArr)

        {

            NSString* bundleid =@"";

            NSString* target = [tmpdescription];

            NSArray * arrObj = [target componentsSeparatedByString:@" "];

            if([arrObjcount]>2) {

                bundleid = [arrObjobjectAtIndex:2];

            }

            if(![bundleidcontainsString:@"com.apple."]) {

                NSLog(@"*******  %@  *****",bundleid);

            }

        }

        returnArr;

    }

    相关文章

      网友评论

          本文标题:iOS - 获取手机上所有安装的app的bundle id

          本文链接:https://www.haomeiwen.com/subject/jgqdyctx.html