20 Ekim 2012 Cumartesi

Dropping ios 4.3 support

If you are one of the developers who think ios 4.3 is not worth supporting any more but can't be sure about it at the same time, here comes the latest stats to the rescue. I saw from live stats that currently ios 4.3.x seems to have 3% percentage in active sessions.

I think it is okay to drop 4.3.x support from now on. It's only 3% and it creates a lot of trouble for the developers who want to use ios 5 or 6 features. At the best case, your code is filled with if (IOS_VERSION > 5.0f) statements, at the worst case you get crashes in ios 4.3.x.

If you don't want to lose those guys using ios 4.3.x completely, you might degrade gracefully for them. That is some features will not be supported in ios 4.3 but they will still be able use the app with basic functionality. Try not to crash if you will follow this approach. Otherwise you can get low ratings from them.

But still, even if you drop support for ios 4.3.x, don't forget to follow MVC correctly and try not to abuse UIViewController's. See my previous blog post about it.

1 Ekim 2012 Pazartesi

NSString length for 4-byte characters

If you worked with 4 bytes characters -such as emoji- on ios, you should have noticed that NSString handles those 4-byte characters a little different than expected. Well, I might be missing something but it counts a 4-byte emoji as 2 characters.

Hence, If you need to process a string which contains a 4-byte character, you might need some new methods to calculate the length or offset in that string. I wrote two category methods for this purpose. One finds the length of the string and the other converts an offset calculated by NSString methods to the correct value. Feel free to use them if you need:

Note: NSString counts a 3-byte character as 1 character as expected.