respondsToSelector to know which ios version user is running

I'm new to programming and had a question. As newer API comes out, like things in iOS 5 for example, do you need to have two ways of doing something (pre ios5 and ios5)? Like

if ([respondsToSelector: (some ios 5 method)]) {
   // use iOS 5 methods
else {
   // use pre ios 5 methods

Sorry if this is a noob question, it's just not something that was really covered in the classes I've taken so far. Thanks.


Yes this is a perfectly acceptable method to check for available APIs.

Need Your Help

Use command line options of PhantomJS programmatically in CasperJS

phantomjs casperjs

Is there a way to use PhantomJS's command line options programmatically?

Detecting file opening in Linux

python linux file

I'm writing a daemon, monitoring user activity on Linux. Is there any way to detect opening arbitrary file by arbitrary process? Preferred language is Python/C/C++