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'd say no, it's not safe. Version numbers are not really numbers but hierarchies of numbers. Consider for instance three version numbers:
1.19
1.3
1.30
A numeric comparison would put 1.19 as being smaller than 1.3 and 1.30. It would also say 1.3 and 1.30 are equal. If the above are version numbers, that is almost certainly not what you want.
There's also the issue of localisation*. In French, the above would not even parse as numbers.
It's far better to treat version numbers as what they are, a hierarchy of separate integers. You can easily chop them up with -componentsSeparatedByString:
*Somewhat ironically, my browser is flagging the British English spelling of localisation as being incorrect.