zoukankan      html  css  js  c++  java
  • 获取手机信息

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

    [[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 大于  */
           /** 大于 */
        }
     
  • 相关阅读:
    独木桥上的羊和狼
    Mac 如何截屏(快捷键)
    Mac 版 QQ 可直接访问 iPhone 的相册 ?!
    年轻时就该追求绚烂之极
    Java-HTTP连接时如何使用代理(二)—— Proxy类方式
    Java-HTTP连接时如何使用代理(一)—— System.Property方式
    妻子的空位——韩国一位单亲爸爸的心声
    不得不
    为了避免结束,你避免了一切开始
    iPhone —— 如何自制铃声(图文)
  • 原文地址:https://www.cnblogs.com/10-19-92/p/5297707.html
Copyright © 2011-2022 走看看