您的位置:首页 > 移动开发 > IOS开发

iOS 怎样获得设备及应用相关信息

2017-08-16 14:50 369 查看
  UIDevice *device = [[UIDevice alloc] init];

    NSLog(@"设备所有者名称  %@  ",device.name);//设备所有者名称

    NSLog(@"设备类别  %@",device.model);//设备类别

    NSLog(@"本地化版本  %@",device.localizedModel);//本地化版本

    NSLog(@"当前系统版本  %@",device.systemVersion);//当期版本

    NSLog(@"当前系统  %@",device.systemName);//当前系统

    NSLog(@"系统唯一标示符  %@",[[[UIDevice currentDevice ] identifierForVendor] UUIDString]);//唯一标示

    NSLog(@"电量   %f",[[UIDevice currentDevice] batteryLevel]);//输出-1为模拟器  输出0-1为真机

    
     NSArray *languageArray = [NSLocale preferredLanguages];

    for (NSString *language in languageArray) {

        NSLog(@"语言:%@", language);//语言

    }

    NSLocale *locale = [NSLocale currentLocale];

    NSString *country = [locale localeIdentifier];

    NSLog(@"国家:%@", country); //国别

    

  

    //分辨率

    CGFloat scale_screen = [UIScreen mainScreen].scale;

    NSLog(@"screen w:%f",width*scale_screen);

    NSLog(@"screen h:%f",height*scale_screen);

    

    //获得运营商信息

    CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];

 

    NSLog(@"info  %@", info);

    //  获取运行商的名称

    CTCarrier *carrier = [info subscriberCellularProvider];

    NSString *mCarrier = [NSString stringWithFormat:@"%@",[carrier carrierName]];

    NSLog(@"%@", mCarrier);

    //app应用相关信息的获取

    NSDictionary *dicInfo = [[NSBundle mainBundle] infoDictionary];

    NSLog(@"应用所有信息 %@",dicInfo);

    NSString *strAppName = [dicInfo objectForKey:@"CFBundleDisplayName"];

    NSLog(@"App应用名称:%@", strAppName);

    NSString *strAppVersion = [dicInfo objectForKey:@"CFBundleShortVersionString"];

    NSLog(@"App应用版本:%@", strAppVersion);

    NSString *strAppBuild = [dicInfo objectForKey:@"CFBundleVersion"];

    NSLog(@"App应用Build版本:%@", strAppBuild);

    NSString *strAppBundleIdentifier = [dicInfo objectForKey:@"CFBundleIdentifier"];

    NSLog(@"App应用唯一标示符:%@", strAppBundleIdentifier);

    NSLog(@"wanluo:%@",info.currentRadioAccessTechnology);

   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息