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

  • 相关阅读:
    [IOS+PHP Jason格式的发送与解析]
    SQL查询排序某字段并选前N条数据
    [IOS Tableview] cell自定义view显示错误问题
    [IOS多线程]的使用:防止进行HTTP数据请求时,UI卡死。
    [IOS NSUserDefaults]的使用:登陆后不再显示登录界面。
    Rafy框架
    jmeter压测-负载配置
    定时任务的实现方式
    Storm学习笔记
    Java线程池的实现
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4103118.html
Copyright © 2011-2022 走看看