iOS判断是否是最新的版本

在开发中, 假如我们设置启动页面的时候, 需要判读一下我们的应用是不是第一次启动,或者 是不是版本的升级。然而我们需要在程序中,通过

    //服务器获取当前的最新版本的版本号,报存到saveVersion

    NSString *currentVersion = [[NSBundle mainBundle] infoDictionary][kBundleVersionKey];   //当前的版本


    if ([currentVersion isEqualToString:saveVersion]) {

        

    }else{

       

    }

infoDic包含如下所有的信息:也就是我们的程序信息:

{


 BuildMachineOSBuild = 15C50;

    CFBundleDevelopmentRegion = en;

    CFBundleExecutable = ZYGLaunchIntroductionDemo;

    CFBundleIdentifier = "com.huaxinlongma.ZYGLaunchIntroductionDemo";

    CFBundleInfoDictionaryVersion = "6.0";

    CFBundleInfoPlistURL = "Info.plist -- file:///Users/lanouhn/Library/Developer/CoreSimulator/Devices/84454B75-C87C-4752-A24B-095EAAC00443/data/Containers/Bundle/Application/09AB9754-B19E-4F63-869B-B8D6C319EE85/ZYGLaunchIntroductionDemo.app/";

    CFBundleName = ZYGLaunchIntroductionDemo;

    CFBundleNumericVersion = 16809984;

    CFBundlePackageType = APPL;

    CFBundleShortVersionString = "1.0";

    CFBundleSignature = "????";

    CFBundleSupportedPlatforms =     (

        iPhoneSimulator

    );

    CFBundleVersion = 1;

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

    DTPlatformBuild = "";

    DTPlatformName = iphonesimulator;

    DTPlatformVersion = "9.2";

    DTSDKBuild = 13C75;

    DTSDKName = "iphonesimulator9.2";

    DTXcode = 0720;

    DTXcodeBuild = 7C68;

    LSRequiresIPhoneOS = 1;

    MinimumOSVersion = "8.1";

    UIDeviceFamily =     (

        1

    );

    UILaunchStoryboardName = LaunchScreen;

    UIRequiredDeviceCapabilities =     (

        armv7

    );

    UISupportedInterfaceOrientations =     (

        UIInterfaceOrientationPortrait,

        UIInterfaceOrientationLandscapeLeft,

        UIInterfaceOrientationLandscapeRight

    );

}

这些并不是我们在程序info.plist 看到的那些key 值。很多都是 以BF为key 来进行字典的存储。



你可能感兴趣的:(iOS)