iOS info.plist 获取与解读

最近决定捋一遍iOS基础,先从项目的配置说起吧


    // 方法一,获取文件的全部路径, 解析 info.plist

    NSString *filePath = [[NSBundle mainBundle]pathForResource:@"Info.plist" ofType:nil];

    NSDictionary *infoDic = [NSDictionary dictionaryWithContentsOfFile:filePath];

    

    //方法二  直接获取

    NSDictionary *infoDicNew = [NSBundle mainBundle].infoDictionary;

    NSLog(@"info.plist %@",infoDicNew);



    

    // 综上所述, 方法2是系统对方法一的一个封装

    

 info.plist 实则是一个字典,可在Xcode中可视化。 获取 系统版本、BundleID 等都需要用到


2018-03-26 17:39:49.874458+0800 test[5712:549958] info.plist {

    BuildMachineOSBuild = 17D47;

    CFBundleDevelopmentRegion = en;

    CFBundleExecutable = test;

    CFBundleIdentifier = "com.sht.test";

    CFBundleInfoDictionaryVersion = "6.0";

    CFBundleName = test;

    CFBundleNumericVersion = 16809984;

    CFBundlePackageType = APPL;

    CFBundleShortVersionString = "1.0";

    CFBundleSupportedPlatforms =     (

        iPhoneSimulator

    );

    CFBundleVersion = 1;

    DTCompiler = "com.apple.compilers.llvm.clang.1_0";

    DTPlatformBuild = "";

    DTPlatformName = iphonesimulator;

    DTPlatformVersion = "11.2";

    DTSDKBuild = 15C107;

    DTSDKName = "iphonesimulator11.2";

    DTXcode = 0920;

    DTXcodeBuild = 9C40b;

    LSRequiresIPhoneOS = 1;

    MinimumOSVersion = "11.2";

    UIDeviceFamily =     (

        1,

        2

    );

    UILaunchStoryboardName = LaunchScreen;

    UIMainStoryboardFile = Main;

    UIRequiredDeviceCapabilities =     (

        armv7

    );

    UISupportedInterfaceOrientations =     (

        UIInterfaceOrientationPortrait,

        UIInterfaceOrientationLandscapeLeft,

        UIInterfaceOrientationLandscapeRight

    );

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值