本人親測有效绒净!更多交流可以家魏鑫:lixiaowu1129苛败,公重好:iOS過審匯總砂代,一起探討iOS技術(shù)!
IOS獲取當(dāng)前版本號 Bundle ID等信息的方法
1:獲取bundle Id信息:[[NSBundle mainBundle]bundleIdentifier]旦部;
2:獲取版本號:[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleShortVersionString"];
3:獲取build號:[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleVersion"];
4:獲取App顯示名:[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleDisplayName"];
其實 [[NSBundle mainBundle]infoDictionary] 獲得的是一個字典,里邊放著Info.plist文件中的各種信息,根據(jù)不同的鍵去即可罐旗,如:
CFBundleDevelopmentRegion
CFBundleDisplayName
CFBundleExecutable
CFBundleExecutablePath
CFBundleIdentifier
CFBundleInfoDictionaryVersion = "6.0";
CFBundleInfoPlistURL
CFBundleName
CFBundlePackageType
CFBundleShortVersionString
CFBundleSignature
CFBundleSupportedPlatforms