New versions of the iOS keep coming, and they aren’t going to stop.
With ever new version comes new features, and necessitates the need to adapt old code. In order to accommodate new features while keeping compatibility with older versions of iOS your code can start to look like a big mess of if statements. And make no mistake about it.. many people don’t regularly update their OS like us computer geeks so you are missing out if you only target one version of iOS — especially right now with the two different devices (iPhone and iPad) running different versions of iOS.
I was actually just looking for a nice way to do this myself, and fortunately Matt Gallagher from Cocoa with Love has just come up with a great article featuring tips and tricks to use so that you can not only make your code compatible, but do it in a nice clean way.
His article Tips & Tricks for conditional iOS3, iOS3.2 and iOS4 code features tips on:
- How to compile a single project to work across multiple versions of the iPhone and iPad OS
- How to use newer features while accommodating older operating systems
- Making the code clean by using some nifty macros
- Keeping the code clean without using any macros
Be sure to check it out if you are looking to build code that accommodates older operating systems while still using newer features.
If you found this helpful, please share it!
[Source: Cocoa With Love]