本文介绍了Obj-C,如何处理包含4个部分的版本号?大于等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这将不是一个具有挑战性的练习,但是我想我要问一下,以防万一Objective-c中已经有一些方法了.

I know this isn't going to be a challenging exercise, but I thought I'd ask, just in case there's some methods already in objective-c etc.

在我的应用中,我只处理2号版本号,例如1.5

In my app I only handle a 2 number version number e.g. 1.5

我想将此数字升级为最多4位数字的数字.

I want to upgrade this to 4 numbers which could have up to 4 digits.

因此,我需要处理现有数字,并在传递数据库版本和捆绑软件版本号时返回false的true.

So I need to handle existing numbers and return true of false when passed database version and the bundle version numbers.

此刻我只是做

NSString *strOnePointFive = @"1.5";
if (dblDBVersion < [strOnePointFive doubleValue]) {

}

推荐答案

这是重复,采用其他格式.以下是一些有关如何处理等于或大于或小于所需版本号的版本号的答案.该链接中的答案是..

This is a duplicate, was in other formats. Here are some answers to how to handle the version numbers, either equal, greater or below the required version number. Which is answer in this link..

NSString *reqSysVer = @"3.1";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
    isSupported = YES;
else
    isSupported = NO;

这篇关于Obj-C,如何处理包含4个部分的版本号?大于等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 08:24