获取应用程序的名称和版本号

 NSDictionary* infoDict =[[NSBundlemainBundle] infoDictionary];

 NSString*appName =[infoDictobjectForKey:@"CFBundleDisplayName"];  // 应用程序名称

 NSString* versionNum =[infoDict objectForKey:@"CFBundleVersion"];  // 应用程序版本号

在此将infoDict打印出来

2014-11-07 14:20:51.339 XiaomaTOEFL[6913:60b] -[OIK_FeedBackViewController sendBtnAction](149): {

    BuildMachineOSBuild = 13F34;

    CFBundleDevelopmentRegion = en;

    CFBundleDisplayName = XiaomaTOEFL;

    CFBundleExecutable = XiaomaTOEFL;

    CFBundleIdentifier = "com.xiaoma.XiaoMaTuoFu";

    CFBundleInfoDictionaryVersion = "6.0";

    CFBundleInfoPlistURL = "Info.plist -- file:///var/mobile/Applications/ED2D2912-E523-49DE-8281-0A1508885E8C/XiaomaTOEFL.app/";

    CFBundleName = XiaomaTOEFL;

    CFBundleNumericVersion = 83984384;

    CFBundlePackageType = APPL;

    CFBundleShortVersionString = "5.0.0";

    CFBundleSignature = "????";

    CFBundleSupportedPlatforms =     (

        iPhoneOS

    );

    CFBundleURLTypes =     (

                {

            CFBundleTypeRole = Editor;

            CFBundleURLSchemes =             (

                "sina.5416b4d0fd98c565690171cf"

            );

        },

                {

            CFBundleTypeRole = Editor;

            CFBundleURLSchemes =             (

                tencent101042219

            );

        }

    );

    CFBundleVersion = "5.0.1";

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

    DTPlatformBuild = 12B411;

    DTPlatformName = iphoneos;

    DTPlatformVersion = "8.1";

    DTSDKBuild = 12B411;

    DTSDKName = "iphoneos8.1";

    DTXcode = 0610;

    DTXcodeBuild = 6A1052d;

    LSRequiresIPhoneOS = 1;

    MinimumOSVersion = "7.0";

    UIDeviceFamily =     (

        1

    );

    UILaunchImages =     (

                {

            UILaunchImageMinimumOSVersion = "7.0";

            UILaunchImageName = "LaunchImage-700-568h";

            UILaunchImageOrientation = Portrait;

            UILaunchImageSize = "{320, 568}";

        }

    );

    UIRequiredDeviceCapabilities =     (

        armv7

    );

    UISupportedInterfaceOrientations =     (

        UIInterfaceOrientationPortrait,

        UIInterfaceOrientationLandscapeLeft,

        UIInterfaceOrientationLandscapeRight

    );

    UIViewControllerBasedStatusBarAppearance = 0;

}


可见infoDict包含了项目中几乎所有的基本信息。

你可能感兴趣的:(iOS开发)