iOS 根据版本号控制某个功能是否开启

//根据版本号控制是否开启
+(BOOL)compareVesionWithServerVersion:(NSString *)version{

BOOL isOpen = YES;

NSArray *versionArray = [version componentsSeparatedByString:@"."];//服务器返回版

NSArray *currentVesionArray = [kAppInfo.appOutVersion componentsSeparatedByString:@"."];//当前版本

NSInteger a = (versionArray.count > currentVesionArray.count) ? currentVesionArray.count : versionArray.count;    

for (int i = 0; i < a; i++) {
    
    NSInteger a = [[versionArray safeObjectAtIndex:i] integerValue];

    NSInteger b = [[currentVesionArray safeObjectAtIndex:i] integerValue];

    if (a > b) {//有新版本

        isOpen = YES;

    }else if(a < b){

        isOpen = NO;
    }
}
return isOpen;

}

你可能感兴趣的:(iOS 根据版本号控制某个功能是否开启)