iOS 獲取程序~項目app名稱、版本號、build版本

//聯(lián)系人:石虎QQ:1224614774昵稱:嗡嘛呢叭咪哄

/**

1.圖形顯示

2.代碼實現(xiàn)

3.下載 demo

*/

一、圖形展示

圖1:

圖2:

二、代碼實現(xiàn)

//

//? ViewController.m

//? 自動增減算法

//

//? Created by 石虎 on 2017/9/29.

//? Copyright ? 2017年 石虎. All rights reserved.

//

#import"ViewController.h"

@interface ViewController ()

@end

/** 獲取APP名稱 */

#define APP_NAME ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"])

/** 程序版本號 */

#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

/** 獲取APP build版本 */

#define APP_BUILD ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"])

/** User-Agent */

#define APP_USER_AGENT [NSString stringWithFormat:@"石虎/%@ (%@;U;%@ %@;%@/%@)", \

APP_VERSION, DeviceModel, DeviceSystemName, DeviceVersion, DeviceLocal, DeviceLang]

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

NSLog(@"獲取APP名稱 === %@,程序版本號===,%@,獲取APP build版本==,%@",APP_NAME,APP_VERSION,APP_BUILD);

}

@end

三、打印結(jié)果

打印:2017-10-0915:05:03.296自動增減算法[44032:2027891] 獲取APP名稱 === shihu ,程序版本號===,1.0.2,獲取APP build版本==,12345

四、下載 demo 鏈接

請聯(lián)系本人,代碼會發(fā)布在 GitHub 或者是碼云上;

謝謝!!!

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容