IOS开发 代码获取当前APP的版本号

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

<code style="padding: 0px; margin: 0px; white-space: nowrap; border: 0px; background-color: rgb(246, 246, 246); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; vertical-align: baseline;"><span style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; font-size: 14px;"><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">[[[</span><span class="typ" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; color: rgb(43, 145, 175); border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">NSBundle</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> mainBundle</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> infoDictionary</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> objectForKey</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">:@</span><span class="str" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; color: rgb(128, 0, 0); border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">"CFBundleShortVersionString"</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span></span></code>
//或
<code style="padding: 0px; margin: 0px; white-space: nowrap; border: 0px; background-color: rgb(246, 246, 246); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; vertical-align: baseline;"><span style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; font-size: 14px;"><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">[[</span><span class="typ" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; color: rgb(43, 145, 175); border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">NSBundle</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> mainBundle</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> objectForInfoDictionaryKey</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">:@</span><span class="str" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; color: rgb(128, 0, 0); border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">"CFBundleShortVersionString"</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">];</span></span></code>

//获得build号:
<code style="padding: 0px; margin: 0px; white-space: nowrap; border: 0px; background-color: rgb(246, 246, 246); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; vertical-align: baseline;"><span style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; font-size: 14px;"><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">[[[</span><span class="typ" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; color: rgb(43, 145, 175); border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">NSBundle</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> mainBundle</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> infoDictionary</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span><span class="pln" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;"> objectForKey</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">:@</span><span class="str" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; color: rgb(128, 0, 0); border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">"CFBundleVersion"</span><span class="pun" style="padding: 0px; margin: 0px; line-height: 25.200000762939453px; border: 0px; background-image: none; background-attachment: scroll; background-color: transparent; vertical-align: baseline; background-position: 0% 0%; background-repeat: repeat repeat;">]</span></span></code>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值