• 获取手机信息


    一些常用手机信息获取方法:

    [[NSProcessInfo processInfo] hostName]
        //globallyUniqueString 唯一的标示符,每次调用都会不一样,可以用作一些临时缓存文件的名字
        [[NSProcessInfo processInfo] globallyUniqueString]
        //操作系统名称
        [[NSProcessInfo processInfo] operatingSystemName]
        //操作系统版本
        [[NSProcessInfo processInfo] operatingSystemVersionString]
        //物理内存
        [[NSProcessInfo processInfo] physicalMemory]
        //进程名称
        [[NSProcessInfo processInfo] processName]
       
        //供应商标识
        [UIDevice currentDevice].identifierForVendor
        //设备类型(iPhone、iPad)
        [UIDevice currentDevice].userInterfaceIdiom
        //设备名字
        [UIDevice currentDevice].name
        //系统名字
        [UIDevice currentDevice].systemName
        //系统版本
        [UIDevice currentDevice].systemVersion
        //模型
        [UIDevice currentDevice].model
        //本地化的模型
        [UIDevice currentDevice].localizedModel
        //电池状态
        [UIDevice currentDevice].batteryLevel
       
        //HostName: dounen
        //GlobalUniqueString: B4B1EC8C-A805-434B-9D57-106ED70C214A-3528-00000AF6A42D73D7
        //OperatingSystemName: NSMACHOperatingSystem
        //OperatingSystemVersion: Version 7.1.1 (Build 11D201)
        //PhysicalMem: 1035976704
        //ProcessName: CityOfHeart
        //UniqueId: <__NSConcreteUUID 0x16693c80> 5ACF8DA1-FAC1-4D70-AB1F-BB696188C5CA
        //userInterfaceIdiom: 0
        //Name: 童年
        //SystemName: iPhone OS
        //SystemVersion: 7.1.1
        //Model: iPad
        //LocalizeModel: iPad
        //BatteryLevel: -1.000000

    在获取版本号问题上,开发中经常使用的是  [[UIDevice currentDevice].systemVersion floatValue];

    但是这样取到是不准确的,比如有的系统版本是8.2,这样取到的有的时候是8.1998,这样你 手机系统版本号>=8.2的话就会出现问题,

    并且有的时候手机系统版本号是9.2.1,你取出来的是9.2,这样比较可能也会出现问题,

    所以,还是使用字符串判断版本号准确些:

        /** 版本号比较 */
        NSComparisonResult result = [@"9.2.1" compare:@"9.2" options:NSCaseInsensitiveSearch];
        if (result == NSOrderedDescending) { /** NSOrderedDescending 大于  */
           /** 大于 */
        }
     
  • 相关阅读:
    pycharm修改快捷键
    pycharm如何解决新建的文件没有后缀的问题
    创建py模板
    用ctrl+鼠标滚动调节字体大小
    pycharm调整代码长度分割线
    pycharm怎么设置代码自动补齐
    python3用BeautifulSoup抓取div标签
    python3用BeautifulSoup用re.compile来匹配需要抓取的href地址
    python3用BeautifulSoup用limit来获取指定数量的a标签
    python3用BeautifulSoup用字典的方法抓取a标签内的数据
  • 原文地址:https://www.cnblogs.com/10-19-92/p/5297707.html
Copyright © 2020-2023  润新知