zoukankan      html  css  js  c++  java
  • ?Object-C获取手机设备信息

    一、获取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]);
    复制代码
  • 相关阅读:
    Asp.net 中 listbox 滚动条 定位 火麒
    Silverlight跨域访问WCF服务 火麒
    网页加载速度优化技巧
    很漂亮的login
    ireport
    方法1,定位,相当于四周受力
    方法2,平移
    大端小端数据存储方式
    c++中RTTI
    C语言细节数组a+1和&a+1
  • 原文地址:https://www.cnblogs.com/yaosuc/p/4544141.html
Copyright © 2011-2022 走看看