zoukankan      html  css  js  c++  java
  • iOS-iPhone系统版本号-iPhone App版本号

    转载: http://blog.sina.com.cn/s/blog_7b9d64af0101bu9j.html

    很多时候,我们需要获得用户iPhone版本号,或者App的当前版本号。
    关心以下两个方面:
    一、App项目中,应用程序逻辑会根据iPhone硬件的版本号来进行相应的处理!
    二、由于某种需求,我们需要得到我们App的当前版本。
     
    一、获得客户端用户的硬件版本号
     

    // 判断设备的iOS 版本号

        float version = [[[UIDevice currentDevice] systemVersion] floatValue];

        NSLog(@"%f",version);

    二、我们还可以获得更多相应的设备信息

     NSLog(@"%@",[[UIDevice currentDevice] name]); // Name of the phone as named by user

        NSLog(@"%@",[[UIDevice currentDevice] uniqueIdentifier]); // A GUID like string 

        NSLog(@"%@",[[UIDevice currentDevice] identifierForVendor]); // A GUID like string(iOS 6.0)

        NSLog(@"%@",[[UIDevice currentDevice] systemName]); // "iPhone OS"

        NSLog(@"%@",[[UIDevice currentDevice] systemVersion]); // "5.1.1"

        NSLog(@"%@",[[UIDevice currentDevice] model]); // "iPhone" on both devices

        NSLog(@"%@",[[UIDevice currentDevice] localizedModel]); // "iPhone" on both devices

    三、获得App的版本号

    // 获得软件的版本号,

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

        float softVerson =[[infoDict objectForKey:@"CFBundleShortVersionString"] floatValue];

    读取 Info.plist文件的信息。

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

  • 相关阅读:
    JS中的instanceof和typeof
    JSONP跨域的原理解析
    svn add 忽略node_modules
    淘宝flexible.js的使用
    最简单的方式实现rem布局
    关于不同retina的布局
    es5实现es6方法
    Webpack loaderUtils.parseQuery()
    npm操作命令
    阿里云服务器配置https
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4103118.html
Copyright © 2011-2022 走看看