iOS应用版本更新(自动提醒用户更新代码)

不建议使用,使用应用版本更新功能提交App Store会被拒!

一.在#import "AppDelegate.h" 文件中的application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法中调用检测结果


iOS应用版本更新(自动提醒用户更新代码)_第1张图片
Enter your image description here:

二. 获得发布版本的Version


iOS应用版本更新(自动提醒用户更新代码)_第2张图片
Enter your image description here:

三.比较当前版本与新上线版本做比较


iOS应用版本更新(自动提醒用户更新代码)_第3张图片
Enter your image description here:

四.UIAlertView代理方法


iOS应用版本更新(自动提醒用户更新代码)_第4张图片
Enter your image description here:

获取设备或APP信息

    //返回应用程序名称
    +(NSString *) getAppName{
        NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
        return [infoDictionary objectForKey:@"CFBundleDisplayName"];
    }
    //返回应用版本号
    +(NSString *) getAppVersion{
        NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
        return [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    }
    +(NSString *) getAppBundleVersion{
        NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
        return [infoDictionary objectForKey:@"CFBundleVersion"];
    }
    //设备型号
    +(NSString *) getSystemName{
        return [[UIDevice currentDevice] systemName];
    }
    //设备版本号
    +(NSString *) getSystemVersion{
        return [[UIDevice currentDevice] systemVersion];
    }

你可能感兴趣的:(iOS应用版本更新(自动提醒用户更新代码))