i have built my application using xcode 5 to support ios 6 or above.I want the same application to work on versions less than 6. I am not using auto layout.I changed all my nib files to build with os 4.3 or later.But the deprecated methods do not work on the older versions.what is the best possible way to support multiple ios versions(In my case ios 4.3 to ios 7.0)?.
-
3Why support iOS 4.3, 80% is on iOS 7 the rest is on 6 and some are on 5. 4.3 is hardly used. But that aside, Yes use NIB and check if the method you are calling is avilable on al version. If you need to call some method not available on a version use `respondsToSelector:` to check if it is supported. – rckoenes Jan 08 '14 at 09:42
-
my requirement is to support devices ranging from ios 4.3 to ios 7...OK using respondToselector will get to know if its supported or not.What to do if its not supported ?? – sujay Jan 08 '14 at 09:45
-
have a look at this question... http://stackoverflow.com/questions/12776932/supporting-ios-4-3-to-ios-6-0 – Chethan Shetty Jan 08 '14 at 09:54
3 Answers
http://www.raywenderlich.com/42591/supporting-multiple-ios-versions-and-devices can give you good advices.
short part of the article:
Unsupported classes
Sometimes you want to use a class that exists in
your base SDK, but not in your deployment target. To do this you need
to check the availability of this class at runtime to avoid crashing
your app. It crashes because this is what the Objetive-C
runtime will
do if you try to use a class that doesn’t exist. As of iOS 4.2,
classes are weakly linked so you can use the +class method to perform
the runtime check. For example:
if ([SLComposeViewController class]) {
//Safe to use SLComposeViewController } else {
//Fail gracefully }
Unsupported methods
Similarly, if you’re using a method in your base SDK that doesn’t exist in your deployment
target, you can avoid nasty crashes by using a little introspection.
The methods -respondsToSelector:
and +instancesRespondToSelector:
will
both do the trick, as shown in the code examples below:
if
([self.image respondsToSelector:@selector(resizableImageWithCapInsets:resizingMode:)])
{
//Safe to use this way of creating resizable images } else {
//Fail gracefully }
The same goes for verifying the existence of class methods, except you call respondsToSelector: on the class itself, like so:
if ([UIView
respondsToSelector:@selector(requiresConstraintBasedLayout)]) {
//Safe to use this method } else {
//Fail gracefully }
Please avoid to make deployment target as 4.3. use this link currently no device using 4.3. its waste of time
you can do with only native code or xib if you want do app with deployment target as 4.3.
because auto layout doesn't support 4.3 and 5.0
stroyboard not support 4.3

- 22,873
- 9
- 61
- 85
What I would like to suggest you, first block your code by version. I mean make block for deprecated methods like IOS 7, IOS 6 as on. Then try to find out the appropriate method that is supported by that version. But as far I knew you can't give full support to the version 4.3 like 7.
As @rckoenes say 80% is on iOS 7 the rest is on 6 and some are on 5. 4.3 is hardly used
so I am also not give support below 6.0. So best of luck.

- 7,073
- 8
- 39
- 86