最新消息:文章中包含代码时,请遵守代码高亮规范!

iOS 获取应用程序的名称、版本号等信息

iOS Alina 338浏览 0评论

获取应用程序的名称、版本号等信息:

NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
//build
NSString *CFBundleVersion = [infoDict objectForKey:@"CFBundleVersion"];
//app的DisplayName
NSString *DisplayName = [infoDict objectForKey:@"CFBundleDisplayName"];
//BundleId
NSString *CFBundleIdentifier = [infoDict objectForKey:@"CFBundleIdentifier"];
//version (如:0.0.0.1)
NSString *CFBundleShortVersionString = [infoDict objectForKey:@"CFBundleShortVersionString"];
NSString *version = [NSString stringWithFormat:@"%@.%@",CFBundleShortVersionString,CFBundleVersion];
NSLog(@"infoDict==%@",infoDict);
NSLog(@"version==%@",version);

转载时请注明出处及相应链接,本文永久地址:http://blog.it985.com/21744.html

您必须 登录 才能发表评论!