Xcode6与Xcode5获取app的Version、名称以及Bulid

转载地址:http://www.th7.cn/Program/IOS/201409/285479.shtml


   NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];


    NSString *version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];

    NSString *build = [infoDictionary objectForKey:@"CFBundleVersion"];

    

Xcode6中获取APP名称

    NSString *name = [infoDictionary objectForKey:@"CFBundleName"];

Xcode5中获取APP名称

    NSString *name = [infoDictionary objectForKey:@"CFBundleDisPlayName"];


其实这就是对应着info.plist中的CFBundleName,CFBundleDisPlayName。只不过Xcode5用的是CFBundleDisPlayName来个APP命名

你可能感兴趣的:(ios,xcode,ios开发)