Hi there Am wondering if the app i wrote right now, which 开发者_Go百科runs perfectly well from IOS 3.1 to 4.2, but how can i make sure it continues running in future releases like IOS 4.3 and so on? My configuration says base SDK is 3.1; does that mean it will run on any IOS above 3.1?
Thanks
Veeru
The long and the short is, you can't completely. What you can do is continue to use APIs that are available in 3.1 for a long period of time. However, if 4.3 depreciates some method, which gets obsoleted in 4.4 and you ignore the deprecation warning, you will have issues.
Best way to react in these cases, is if you have a method that is only available pre 4.2 for instance, you'll have to handle that case. Usually one does this with a respondsToSelector:
style check and weak linking against the framework which provides that. This however won't solve the case where said method may not be available on 4.3, but Apple is usually pretty good about providing a new API if it depreciates another one, so you can just check for that, if it exists, use it, otherwise call the old method.
Little things like this will help you future proof your application, but they're not 100%. The good thing is, typically they'll give you lots of time to respond (a major iOS firmware version bump before they become a problem for you).
If you've set the base SDK to 3.1 and not used any non 3.1 classes/methods then your app should run on iOS 3.1 upwards until (perhaps at some point in the future) a class/method/type you've used might eventually be removed from a successive version of the API after many, many years of being deprecated.
At least, that's the theory.
Most apps continue to run on higher iOS versions. I have a few apps that haven't been updated since 2 years ago that are still running on new iOS 4.2 devices.
Improving the odds at future proofing: Lot and lots of testing. Make sure the app doesn't get too close to any memory or performance limits, and has tons of headroom (for instance, some things got a lot slower on iOS 4.x on a 3G). Stay away from deprecated, non-documented or non-recommend use of all APIs.
精彩评论