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
精彩评论