4

I am building my app using iOS 5.0 as base SDK and iOS 3.0 as deployment target.

I know I need to check for existence of methods and classes when I work with features that are not available in the earlier iOS versions, but lately I've lost a few hours on a problem just to discover I was calling a method not available in some iOS versions. I simply did not notice it was a new method and did no check before to call it. The app of course compiled with 0 errors and 0 warnings.

This is a big problem because if I forgot some other check somewhere in the app, I will not know it until I or, worst, some user will activate that specific part of code.

Maybe I am missing something, is there some compiler option I can set to detect the calls I make to methods not available in the iOS deployment target? How do you deal with such a problem?

Gengis
  • 171
  • 1
  • 9
  • I found this post strictly related to my question: [How to build against older iOS versions with the latest Xcode downloads?](http://stackoverflow.com/q/3747432/452123). – Gengis Feb 01 '12 at 23:46

2 Answers2

1

The only way to check for compatibility with a prior version of iOS, currently, it to test the app on an old non-updated device running that version of the OS.

If you can't find a device that old, even just to borrow for short time, then there may not be a good buiness reason to set the Deployment target that low.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • I understand your comment about a deployment target that low, but the problem I'm talking about can happen with **any** deployment target non equal to the base SDK. And I think nothing would change if I could test my app on a real non updated device, because the problem I'm talking about comes out when I happen to execute the part of code in which I missed to do the check before to call the non available method. The problem is **how to search for this kind of errors**, because once I have the luck to execute the buggy code the app will crash equally in the device and simulator. Thank you. – Gengis Feb 01 '12 at 23:32
  • The Simulator is reported not to accurately represent only the APIs avalilable to the version the iOS SDK it is running. Only the devices run the actual ARM OS code. – hotpaw2 Feb 02 '12 at 01:00
  • Thanks, I read some articles and now I know you are right. I was thinking the main differences between real device/simulator were about computation power and resources. This is bad news, but is also one more reason to try to find a dependable way to locate the calls to possibly missing methods. – Gengis Feb 02 '12 at 22:49
1

This link might point you in the right direction. Supporting mutiple ios Versions in your apps. It explains how to deal with taking advantage of the newer ios features while maintaining backwards compatibility. Hope that helps.

Just a coder
  • 15,480
  • 16
  • 85
  • 138
  • I read the post you linked. The part I find interesting is the one of making a copy of the project and compile it for the old simulator (using old Xcode), generating warnings for the calls to methods not supported. This is something in the direction of what I'm looking for: a way to spot all the calls to methods not available in the deployment target iOS, so I can do a rapid check to verify I correctly managed the compatibility for each one of them. Of course this method requires some work to install and manage old Xcode versions and to do the tests. Thank you. – Gengis Feb 01 '12 at 23:19
  • I would like to keep the question open for some other time. I was hoping to find a way that does not involve the installation of older Xcode versions, also if the more I learn about this, the more it looks technically impossible (see the comment I just added to my question). – Gengis Feb 01 '12 at 23:51
  • The solutions mentioned on the link works. The installation of the older Xcode builds is for required when you want to *test* your solutions in an iOS prior to 3.2.2.. These old SDK's no longer come with Xcode and you'll have to use other means to get them when it comes to testing your apps in prior versions. I guess this is Apple's way of saying.. please upgrade, you're falling behind. – Just a coder Feb 02 '12 at 00:19
  • I agree, and someway I think this 'advice' from Apple is good. But installing a whole old Xcode version just because I want to debug a certain (important, I think) aspect of my app looks so exaggerated to me. Ok my try to support iOS 3.0 also may be exaggerated, but I should do the same work to support 4.0. This is why I'm reluctant to close this question, I keep thinking that Xcode is a so powerful (I really don't know how much) software, really it does not know which methods are missing in the previous SDK? Maybe someone of you knows I'm wasting my time, but I need to be sure. – Gengis Feb 02 '12 at 22:35
  • Why I choose this answer: My question is open since some time now, I left it open hoping to find some more practical solution, but I was too busy to investigate further so it's time to close and choose one answer. The hotpaw2's answer is also good, but since I was looking for a way to spot calls to methods unavailable in old SDKs, I think this one is the more flexible and does not require to have a real device. The testing on real devices is useful of course, but for my question also an Xcode with old SDK will spot the wrong calls at compile time. – Gengis Mar 29 '12 at 19:53