Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

What should i do when i need to use a deprecated method and the current implementation of that same

esko918esko918 esko918Posts: 224New Users @ @
edited September 2016 in iOS SDK Development
So ill take my current circumstance into account as the topic of this question. The current version of the application i am writing can be used with devices running iOS 8 and above. So what i need to do is get a contact from the contacts application and then grab some of their data. Plain and simple i know.

So in order to do this i need to write one set of code that will use the AddressBook framework( iOS <=8.x) and one set of code that will run the Contacts Framework( iOS >=9.x). Im asking this question because i have read numerous ways to go about what i need to do.
  1. One way is to just write the code using the AddressBook framework and be done with it because no matter what(Even if the object/function says its deprecated in the 9.0 version of iOS). That object will still be installed in the SDK so i dont need to write the code using the Contacts Framework. I dont believe this to be 100% accurate which is why im asking this question in the first place.
  2. Another way to go about this is to write the code with both frameworks and then do a runtime check to see if the operating system responds to the code by using
    [self respondsToSelector(@selector(test))
    
    then if the function returns true i would go that route and vice versa.

Im sure its the second route which is writing my code to handle iOS9 and above and iOS8 and below. So what is the best way to go about my problem?
Post edited by esko918 on

Replies

  • RickSDKRickSDK Posts: 1,239Registered Users @ @ @ @
    i'm not 100% sure of your situation, but in general if something has been deprecated, its because its been replaced with a better method. So just use the better method.
  • esko918esko918 esko918Posts: 224New Users @ @
    I cant use the better method. The better method in this circumstance would be the Contacts framework that was added in iOS 9. Since i have to program for devices using iOS 8.0 i cannot use the contacts framework, hence why i need to write this code twice.
Sign In or Register to comment.