美文网首页iOS 技巧
IOS 如何获取到手机中安装的所有App

IOS 如何获取到手机中安装的所有App

作者: 一支烟一只猿 | 来源:发表于2020-07-14 11:27 被阅读0次
    获取到手机中安装的所有App、目前只在模拟器上成功
    Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
    NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
    NSArray *allApplications = [workspace performSelector:@selector(allApplications)];//这样就能获取到手机中安装的所有App
    
    Class LSApplicationProxy_class = object_getClass(@"LSApplicationProxy");
    for (LSApplicationProxy_class in allApplications)
    {
        //这里可以查看一些信息
        NSString *bundleID = [LSApplicationProxy_class performSelector:@selector(applicationIdentifier)];
        NSString *version =  [LSApplicationProxy_class performSelector:@selector(bundleVersion)];
        NSString *shortVersionString =  [LSApplicationProxy_class performSelector:@selector(shortVersionString)];
        NSLog(@"bundleID:%@\n version: %@\n ,shortVersionString:%@\n", bundleID,version,shortVersionString);
    }
    

    如何获取手机运营商信息、归属地

    #import <CoreTelephony/CTTelephonyNetworkInfo.h>
    
    #import <CoreTelephony/CTCarrier.h>
    
    CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
    
    CTCarrier *carrier = [networkInfo subscriberCellularProvider];
    
    carrier.carrierName;
    
    carrier.isoCountryCode;//cn

    相关文章

      网友评论

        本文标题:IOS 如何获取到手机中安装的所有App

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