2020年12月から、UIWebView は使えず、WKWebView に書き換えなければならない。
ITMS-90809: Deprecated API Usage - App updates that use UIWebView will no longer be accepted as of December 2020. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).
それで、次のコードで WKWebView に書き換えたが、ちょっとした落とし穴があった。
WKWebViewConfiguration *webConfig = [[WKWebViewConfiguration alloc] init]; webConfig.dataDetectorTypes = WKDataDetectorTypeLink; myWebView = [[WKWebView alloc] initWithFrame:webFrame configuration:webConfig];
次のように、iOS 9 で異常終了した。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebViewConfiguration setDataDetectorTypes:]: unrecognized selector sent to instance 0x1688f140'
WKWebView は、iOS 9 で使えるが、次のコードは、iOS 10 以上でないといけなかった。
webConfig.dataDetectorTypes = WKDataDetectorTypeLink; // iOS 10.0+