app名稱:
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
獲取系統(tǒng)版本:
NSString * systemVersion = [UIDevice currentDevice].systemVersion;//10.0.2CGFloat test = [[UIDevice currentDevice] systemVersion].floatValue;//10
iOS代碼實(shí)現(xiàn)獲得項(xiàng)目名稱及版本號(hào)(Version/Build):
NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey];//獲取項(xiàng)目名稱NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];//獲取項(xiàng)目版本號(hào)
iOS的版本號(hào)窗市,一個(gè)叫做Version译柏,一個(gè)叫做Build打却,這兩個(gè)值都可以在Xcode中選中target释簿,點(diǎn)擊"General"后看到蕉斜。 Version在plist文件中的key是“CFBundleShortVersionString”椿争,和AppStore上的版本號(hào)保持一致怕膛。Build在plist中的key是“CFBundleVersion”,代表build的版本號(hào)秦踪,該值每次build之后都應(yīng)該增加1嘉竟。//獲得應(yīng)用的Verison號(hào):[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]或[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];//獲得build號(hào):[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
作者:iOS_feeling鏈接:http://www.reibang.com/p/d2332cfd1d60來源:簡(jiǎn)書著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請(qǐng)聯(lián)系作者獲得授權(quán)洋侨,非商業(yè)轉(zhuǎn)載請(qǐng)注明出處舍扰。