在 iOS 4之后。苹果废弃了 webView.detectsPhoneNumbers = YES; 这个方法来检测电话 号码。现在任然可以继续使用,但是会出现警告。
更换为此方法:webView.dataDetectorTypes=UIDataDetectorTypePhoneNumber;
API文档上如此
typedefNS_OPTIONS(NSUInteger, UIDataDetectorTypes) {
UIDataDetectorTypePhoneNumber =1<<0,// Phone number detection
UIDataDetectorTypeLink =1<<1,// URL detection
#if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
UIDataDetectorTypeAddress =1<<2,// Street address detection
UIDataDetectorTypeCalendarEvent =1<<3,// Event detection
#endif
UIDataDetectorTypeNone =0,// No detection at all
UIDataDetectorTypeAll =NSUIntegerMax// All types
};