views:

174

answers:

1

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.

+2  A: 

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
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?
Digital Robot
`if ([object respondsToSelector:@selector(newMethod)]){[object newMethod];} else{[object deprecatedMethod];}`
executor21
thanks!!!!!!!!!!
Digital Robot
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!
Digital Robot
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
thanks!!!!!!!!!
Digital Robot