3

I am dealing with an old code designed for iPhone OS 2.0. In this code I have some instructions that we deprecated on iPhone 3.0.

I am not willing to change the version because I have many customers, specially on iPod Touch, that are still using 2.0. If I update the instructions they will be unable to continue receiving the updates.

The application is compiled for 2.0 and always have been like that.

I have submitted a new version for Apple, where some bugs were corrected and new functionality was added. I have always sent this app to apple and they never complained. Now they rejected the application telling me that it is crashing under OS 3.1.3.

I've followed their instructions but I don't see any crash and the part of the code that uses the "deprecated" function works perfectly on 3.1.3.

Compiling the project for 3.1.3, I see a yellow warning on Xcode telling me that one instruction was deprecated on 3.1.3.

The big question is: will this instruction work on 3.1.3 and should I ignore this warning? Can this make the iPhone crash?

In my mind, all new versions of the iPhone OS keeps back compatibility with older versions, so, as I think, any application compiled for 2.0 will run on 3.1.3 and all versions up.

As you see, I have tested this on 3.1.3 and the application works perfectly.

How can that be? Any ideas?

thanks for any help.

Duck
  • 34,902
  • 47
  • 248
  • 470

1 Answers1

2

Deprecated calls are designed to work in the OS release that they became deprecated in, but stop working in some (undefined) future OS. The deprecation is a warning to developers: Hey, you should change your code, this WILL break in the future. It's a way to update the API-base without breaking everyone.

In summary, you're okay to use these calls now, but you'll want to edit the code should you ever decide to ditch 2.x operability.

Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
  • Thanks. Is it possible to design a kind of test to see which version is running and executing an alternative updated instruction in case the OS >= version where it became deprecated? How can that be done? – Duck Mar 05 '10 at 02:18
  • 2
    `if ([object respondsToSelector:@selector(newMethod)]){[object newMethod];} else{[object deprecatedMethod];}` – executor21 Mar 05 '10 at 02:45
  • wait, there's a problem with this approach. If I compile for 2.0 it will not compile because the new call was not available for that release! – Duck Mar 05 '10 at 04:10
  • You can follow the procedure and example discussed in this question to compile using 3.0, but target 2.x: http://stackoverflow.com/questions/986589/how-do-you-optionally-use-iphone-os-3-0-features-in-a-2-0-compatible-app – Brad Larson Mar 05 '10 at 10:25