Hadu Hadu - 9 months ago 48
iOS Question

Developing with deprecated frameworks

I have a general question as I found many frameworks are deprecated in iOS 9. Consider developing for iOS 7 and above with the latest Xcode and iOS SDK. I'm going to use

which is deprecated in iOS 9 and replaced with
. In my code when I want to show an alert, should I have to check for iOS version and provide a block of code using
for iOS prior to 9, and another block of code for
for iOS 9 and above?
The same goes for
frameworks which are replaced with

I know that many deprecated frameworks still work fine with new iOS SDK but sometime in future there will be a chance of not working fine.
What would be a good approach on this issue?


First off, UIAlertView was deprecated in iOS 8, not iOS 9.

Deprecated doesn't mean removed. It means obsolete.

As long as an API isn't deprecated in your Deployment Target, it should be safe to use. It's very rare for a deprecated API to actually stop working.

Like everything else, test to be sure everything works on each version of iOS your app supports.

When you drop support for iOS 7 in some future update of your app, you can replace all uses of UIAlertView with uses of UIAlertController.

Similar for AddressBook. Keep using it until your Deployment Target becomes iOS 9 then you can migrate to using the new Contacts framework.

Of course if a new API offers functionality that you wish to use on devices that support, feel free to do so. Just make sure you don't try to use newer APIs on devices with older versions of iOS.

Keep this in mind. There are apps that were written in iOS 2.0 seven years ago. Many of these apps still work under iOS 9.