005-获取App信息
一、获取App的版本号
1 // 1.取得当前项目的info.plist字典 2 NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary; 3 4 // 2.获得当前软件的版本号(Bundle versions string, short)(诸如:1.0) 5 // info.plist中项目版本号的key(版本号在info字典中的key为CFBundleShortVersionString) 6 NSString *versionKey1 = @"CFBundleShortVersionString"; 7 NSString *currentVersion1 = infoDictionary[versionKey1]; 8 9 // 3.获得当前软件的版本号(Bundle version)(诸如:1001) 10 // 取得当前项目的info.plist字典(版本号在info字典中的key为CFBundleVersion) 11 NSString *versionKey2 = @"CFBundleVersion"; 12 NSString *currentVersion2 = infoDictionary[versionKey2]; 13 14 LDLog(@"currentVersion1 = %@ currentVersion2 = %@", currentVersion1, currentVersion2);

浙公网安备 33010602011771号