• iOS开发-Object-C获取手机设备信息(UIDevice)


    一、获取UiDevice设备信息

    // 获取设备名称
    NSString *name = [[UIDevice currentDevice] name];
    // 获取设备系统名称
    NSString *systemName = [[UIDevice currentDevice] systemName];
    // 获取系统版本
    NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
    // 获取设备模型
    NSString *model = [[UIDevice currentDevice] model];
    // 获取设备本地模型
    NSString *localizedModel = [[UIDevice currentDevice] localizedModel];

    二、获取Bundle的相关信息

    NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
    // app名称
    NSString *appName = infoDict[@"CFBundleName"];
    // app版本
    NSString *appVersion = infoDict[@"CFBundleShortVersionString"];
    // app build版本
    NSString *appBuild = infoDict[@"CFBundleVersion"];

    NSLocal获取本地化数据:

    // 获取用户的语言偏好设置列表
    NSLog(@"%@", [NSLocale preferredLanguages]);
    
    // 获取系统所有本地化标识符数组列表
    NSLog(@"%@", [NSLocale availableLocaleIdentifiers]);
    // 获取所有已知合法的国家代码数组列表
    NSLog(@"%@", [NSLocale ISOCountryCodes]);
    // 获取所有已知合法的ISO货币代码数组列表
    NSLog(@"%@", [NSLocale ISOCurrencyCodes]);
    // 获取所有已知合法的ISO语言代码数组列表
    NSLog(@"%@", [NSLocale ISOLanguageCodes]);
    
    // 获取当前系统设置语言的标识符
    // 方法一
    NSLog(@"%@", [[NSLocale currentLocale] localeIdentifier]);
    // 方法二
    NSLog(@"%@", [[NSLocale currentLocale] objectForKey:NSLocaleIdentifier]);

    IOS开发-Swift获取手机设备信息(UIDevice)

  • 相关阅读:
    将eclipse的编码设置成UTF-8
    git提交代码时报rejected
    Vue.js
    快速计算进制之间的转换
    android中canvas.drawText参数的介绍以及绘制一个文本居中的案例
    progressbar原始效果
    面试问题总结
    Android Material Design学习日志
    Android进阶之解决RecyclerView notifyItem闪屏问题
    Android TextView行间距解析
  • 原文地址:https://www.cnblogs.com/GarveyCalvin/p/4167293.html
Copyright © 2020-2023  润新知