//聯(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 或者是碼云上;