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>
獲取系統(tǒng)版本
<pre><code>[[[UIDevice currentDevice] systemVersion] floatValue];
</code></pre><pre><code>
[[UIDevice currentDevice] systemVersion];
</code></pre>
獲取當前語言
<pre><code>[[NSLocale preferredLanguages] objectAtIndex:0]
</code></pre>