[NSBundle mainBundle] 详解

NSLog(@"ios 应用发布后 .app 应用文件 路径::%@",[NSBundle mainBundle] );

    NSLog(@"ios 应用发布后 .app 应用包(文件) 的详细信息 ::%@",[[NSBundle mainBundle] infoDictionary]);

 

 

[[NSBundle mainBundle] infoDictionary] 返回的是一个数据字典内容如下:

(XX1 为当前应用的名字 也就是app 包的名字 )--( 部分地方 XX 大写 我隐藏了部分信息...... )

 ios 应用发布后 .app 应用文件 ::{

    CFBundleDevelopmentRegion = en;

    CFBundleDisplayName = "当前app 文件名XX1";

    CFBundleExecutable = "当前app 文件名XX1";

    CFBundleExecutablePath = "/Users/yq-010/Library/Application Support/iPhone Simulator/5.1/Applications/49419CEE-6608-48FE-81FE-BF40FEEFB8F7/XX1.app/xx1";

    CFBundleIconFiles =     (

        "icon.png",

        "[email protected]"

    );

    CFBundleIcons =     {

        CFBundlePrimaryIcon =         {

            CFBundleIconFiles =             (

                "icon.png",

                "[email protected]"

            );

            UIPrerenderedIcon = 1;

        };

    };

    CFBundleIdentifier = "com.xxxx.xxxxx";

    CFBundleInfoDictionaryVersion = "6.0";

    CFBundleInfoPlistURL = "Info.plist -- file://localhost/Users/yq-010/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/49419CEE-6608-48FE-81FE-BF40FEEFB8F7/XX%20XX%20XX.app/";

    CFBundleName = "XX1";

    CFBundlePackageType = APPL;

    CFBundleShortVersionString = "1.3";

    CFBundleSignature = "????";

    CFBundleSupportedPlatforms =     (

        iPhoneSimulator

    );

    CFBundleVersion = "1.3";

    DTPlatformName = iphonesimulator;

    DTSDKName = "iphonesimulator5.1";

    LSRequiresIPhoneOS = 1;

    NSBundleInitialPath = "/Users/yq-010/Library/Application Support/iPhone Simulator/5.1/Applications/49419CEE-6608-48FE-81FE-BF40FEEFB8F7/XX1.app";

    NSBundleResolvedPath = "/Users/yq-010/Library/Application Support/iPhone Simulator/5.1/Applications/49419CEE-6608-48FE-81FE-BF40FEEFB8F7/XX1.app";

    UIDeviceFamily =     (

        1

    );

    UIPrerenderedIcon = 1;

    UIRequiredDeviceCapabilities =     (

        armv7

    );

    UISupportedInterfaceOrientations =     (

        UIInterfaceOrientationPortrait

    );

}

 

应用1:我们可以通过包的信息的数据字典 得到 应用的版本 CFBundleVersion = "1.3";

当前应用的版本 :

[[[NSBundlemainBundleinfoDictionaryobjectForKey:@"CFBundleShortVersionString"]]

你可能感兴趣的:([NSBundle mainBundle] 详解)