Some time ago, I read that comparing version numbers can be done using the following code snippet:
NSString *vesrion_1 = @\"1.2.1\";
NSString *version_2 = @\
I don't know of anything built in that will do it, but I have heard that the Sparkle framework has a version comparator.
Browsing quickly through the source reveals that the SUStandardVersionComparator object seems to be in charge of it. It conforms to the
NSString *versionA = @"1.2.1";
NSString *versionB = @"1.2.0";
id comparator = [SUStandardVersionComparator defaultComparator];
NSInteger result = [comparator compareVersion:versionA toVersion:versionB];
if (result == NSOrderedSame) {
//versionA == versionB
} else if (result == NSOrderedAscending) {
//versionA < versionB
} else {
//versionA > versionB
}
(note: code untested and typed in a browser. Caveat Implementor)