美文网首页
获取App版本号、系统版本

获取App版本号、系统版本

作者: R_yan | 来源:发表于2016-09-08 09:22 被阅读120次

iOS的版本号分为:Version、Build

  • Version:与App Store上版本号保持一致,在plist文件中的key是"CFBundleShortVersionString"。
  • Build:构建版本,每次build之后都应该加1,在pilst文件中的key是"CFBundleVersion"

获取Version

<pre><code>NSString *currentVersion = [NSBundle mainBundle].infoDictionary[CFBundleShortVersionString];
</code></pre>

获取Build

<pre><code>NSString *currentBuild = [NSBundle mainBundle].infoDictionary[CFBundleVersion];
</code></pre>

获取系统版本

<pre><code>[[[UIDevice currentDevice] systemVersion] floatValue];
</code></pre><pre><code>
[[UIDevice currentDevice] systemVersion];
</code></pre>

获取当前语言

<pre><code>[[NSLocale preferredLanguages] objectAtIndex:0]
</code></pre>

相关文章

网友评论

      本文标题:获取App版本号、系统版本

      本文链接:https://www.haomeiwen.com/subject/vmnjettx.html