Nareshkumar
Nareshkumar

Reputation: 2351

calling deprecated methods?

i have a view controller that uses the getDistance method for calculating the distance between two points. My problem is that starting from iPhone SDK 3.2, the method is deprecated and distanceFrom method is effective. Now i want to build a code that works for both the sdks. How do i do it? One possible solution is to go for responds to selector method and then write accordingly. But i want to know if there is any other alternative.

getDistanceFrom //deprecated after 3.2

Upvotes: 2

Views: 292

Answers (1)

vodkhang
vodkhang

Reputation: 18741

You can use define, do something like this:

    // Set up the parser object.
      parser = [[NSXMLParser alloc] initWithData:xml];
    #if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_3_1
      parser.delegate = (id<NSXMLParserDelegate>) self;
    #else
      parser.delegate = self;
    #endif

Upvotes: 1

Related Questions