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];

  • 相关阅读:
    Superwebsocket 模拟微信聊天室
    python杂记-6(time&datetime模块)
    python杂记-5(装饰器)
    python杂记-4(迭代器&生成器)
    python杂记-3(购买商品)
    python杂记-2(python之文件)
    python杂记-1(os模块)
    淘宝链接中的spm参数
    分布式Web服务器架构(转)
    asp.net网站增加虚拟目录,用来访问网站图片。
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4103118.html
Copyright © 2011-2022 走看看