How to check iOS version at runtime

Share the joy
  •  
  •  
  •  
  •  

iOS 7 has a very good adoption rate, however you might still want to support people that are running older versions of iOS. You can load different storyboards or xib files, different launch screens and handle API differences. You can use the version of the Foundation framework to determine the current system version and load the appropriate resources. The code below shows how to check the Foundation framework version:

    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1){

        //load resources for earlier versions

    } else {

        //load resources for iOS 7

    }

Note that you can check for versions earlier than 6.1, just use the right constant instead of NSFoundationVersionNumber_iOS_6_1.

 


Share the joy
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *

*