Bundle中常用

UUID:

1
[[UIDevice currentDevice] identifierForVendor]

获取info.plist中的key

下面获取的几个如 Bundle identifierApp NameBundle Version 这几个除了key不同,其它的都是一样的,所以我们先来说一下key的获取
获取key
上图操作的是 info.plist 文件,其中鼠标操作后弹出选择框,点击的是 鼠标右键

Bundle identifier:

1
2
3
NSDictionary *dic = [[NSBundle mainBundle] infoDictionary];
NSString *appIdentifier =
[dic objectForKey:@"CFBundleIdentifier"]; //获取Bundle identifier

App Name:

1
2
3
NSDictionary *dic = [[NSBundle mainBundle] infoDictionary];
NSString *appName =
[dic objectForKey:@"CFBundleName"]; //获取Bundle name

Bundle Version:

1
2
3
NSDictionary *dic = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion =
[dic valueForKey:@"CFBundleVersion"]; //获取Bundle Version