iOS 获取程序~项目app名称、版本号、build版本

//联系人:石虎 QQ:1224614774 昵称:嗡嘛呢叭咪哄

/**

 1.图形显示

 2.代码实现

 3.下载 demo

 */

一、图形展示

1:


2:


二、代码实现


//

//  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


三、打印结果

打印: 2017-10-0915:05:03.296 自动增减算法[44032:2027891] 获取APP名称 === shihu ,程序版本号===,1.0.2,获取APP build版本==,12345


四、下载 demo 链接


  请联系本人,代码会发布在 GitHub 或者是码云上;


谢谢!!!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值