info.plist 浅析

info.plist 浅析_第1张图片
info.plist经典界面

Bundle name: 应用名称(一般不使用中文,过不了苹果验证) cmd+shift+h 进入后台查看

Bundle identifier: 表示应用程序的唯一标识符
开发场景:上传工程/推送

Bundle versions string, short: 应用程序版本号(上传更改,版本更新较小就可以为1.0.1,大的话就2.0,保证比当前版本号大)

Bundle version: 编译的版本号

Supported interface orientations: 应用支持方向

plist可读性不好

info.plist 浅析_第2张图片
info.plist可视化界面
// 获取当前版本号
    
    // 1.解析info.plist
    NSString *file = [[NSBundle mainBundle] pathForResource:@"Info.plist" ofType:nil];
    
    NSString *Verice = [[NSDictionary dictionaryWithContentsOfFile:file] objectForKey:@"CFBundleShortVersionString"];
    NSLog(@"dict: %@",[NSDictionary dictionaryWithContentsOfFile:file]);
    NSLog(@"1---%@",Verice);
    
    //2.
     NSString *currenVterice= [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
    NSLog(@"2--%@",currenVterice);
>输出:

dict: {
    BuildMachineOSBuild = 15B42;
    CFBundleDevelopmentRegion = en;
    CFBundleExecutable = "iOS9\U65b0\U7279\U6027";
    CFBundleIdentifier = "iOS9---";
    CFBundleInfoDictionaryVersion = "6.0";
    CFBundleName = "APP  Name";
    CFBundlePackageType = APPL;
    CFBundleShortVersionString = "1.0";
    CFBundleSignature = "????";
    CFBundleSupportedPlatforms =     (
        iPhoneSimulator
    );
    CFBundleVersion = 1;
    DTCompiler = "com.apple.compilers.llvm.clang.1_0";
    DTPlatformBuild = "";
    DTPlatformName = iphonesimulator;
    DTPlatformVersion = "9.3";
    DTSDKBuild = 13E230;
    DTSDKName = "iphonesimulator9.3";
    DTXcode = 0731;
    DTXcodeBuild = 7D1014;
    LSRequiresIPhoneOS = 1;
    MinimumOSVersion = "9.3";
    UIDeviceFamily =     (
        1
    );
    UILaunchStoryboardName = LaunchScreen;
    UIMainStoryboardFile = Main;
    UIRequiredDeviceCapabilities =     (
        armv7
    );
    UISupportedInterfaceOrientations =     (
        UIInterfaceOrientationPortrait,
        UIInterfaceOrientationLandscapeLeft,
        UIInterfaceOrientationLandscapeRight
    );
}
2016-06-03 17:46:30.977 iOS9新特性[8243:342137] 1---1.0
2016-06-03 17:46:30.977 iOS9新特性[8243:342137] 2--1.0

你可能感兴趣的:(info.plist 浅析)