zoukankan      html  css  js  c++  java
  • iOS 中代码获取当前版本号

    [1]概念

    iOS的版本号,一个叫做Version,一个叫做Build,这两个值都可以在Xcode 中选中target,点击“Summary”后看到。 Version在plist文件中的key是“CFBundleShortVersionString”,和AppStore上的版本号保持一致,Build在plist中的key是“CFBundleVersion”,代表build的版本号,该值每次build之后都应该增加1。这两个值都可以在程序中通过下面的代码获得:

    [[[NSBundle mainBundleinfoDictionaryvalueForKey:@"key"]

    [2]具体实现

    代码实现获得应用的Verison号:

    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
    [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
     
    获得build号:
    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
  • 相关阅读:
    异常
    抽象类
    java基础—接口3
    java基础—接口2
    java基础—接口1
    Android拍照适配方案
    继承—Car
    继承—矩形
    使用CSS和jQuery实现tab页
    纯CSS实现圆形进度条
  • 原文地址:https://www.cnblogs.com/fuunnyy/p/5165320.html
Copyright © 2011-2022 走看看