开发者

calling deprecated methods?

开发者 https://www.devze.com 2023-01-07 20:28 出处:网络
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

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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消