查看bundleId和info.plist文件内容


 /******** OC ********/
    // 提取infoplist
    NSDictionary * info = [NSBundle mainBundle].infoDictionary;
    
    // 提取bundleID
    NSString * bundleID = [NSBundle mainBundle].bundleIdentifier;

/******** C *********/
    CFDictionaryRef info = CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    
    CFStringRef bundleId = CFBundleGetIdentifier(CFBundleGetMainBundle());

// 打印所有infoplist文件内容
        let info:[String:AnyObject] = NSBundle.mainBundle().infoDictionary!
        print(info)
        
        // 提取bundleID
        let bundleId = NSBundle.mainBundle().bundleIdentifier
        print(bundleId)



如下为新建的Xcode临时工程里面的infoPlist文件的东西

当然如果向infoplist文件中新添加一些新的配置,添加的配置同样能够打印出来

[
"DTSDKName": iphoneos9.2,
 "CFBundleSupportedPlatforms": (
    iPhoneOS
), 
"CFBundleIdentifier": com.ebeijia.tmp,
 "UIMainStoryboardFile": Main, "CFBundleNumericVersion": 16809984, "CFBundleShortVersionString": 1.0,
 "BuildMachineOSBuild": 15D21,
 "UILaunchStoryboardName": LaunchScreen, 
"DTCompiler": com.apple.compilers.llvm.clang.1_0,
 "DTXcodeBuild": 7C1002,
 "LSRequiresIPhoneOS": 1,
 "UISupportedInterfaceOrientations": (
    UIInterfaceOrientationPortrait,
    UIInterfaceOrientationLandscapeLeft,
    UIInterfaceOrientationLandscapeRight
),
 "DTPlatformBuild": 13C75,
 "CFBundleVersion": 1,
 "UIRequiredDeviceCapabilities": (
    arm64
), 
"DTPlatformVersion": 9.2,
 "CFBundleName": tmp, 
"DTSDKBuild": 13C75,
 "CFBundleInfoDictionaryVersion": 6.0,
 "DTPlatformName": iphoneos,
 "CFBundleSignature": ????,
 "CFBundlePackageType": APPL,
 "UIDeviceFamily": (
    1
), 
"CFBundleExecutable": tmp,
 "DTXcode": 0721, 
"CFBundleInfoPlistURL": Info.plist -- file:///var/mobile/Containers/Bundle/Application/F8DD872B-6926-490D-A0AF-A62ACBE65B19/tmp.app/, 
"MinimumOSVersion": 9.2,
 "CFBundleDevelopmentRegion": en]


你可能感兴趣的:(知识库)