Search code examples
iosuiwebviewuipopovercontroller

Load Maps address from UIWebView inside UIPopoverController


I have programmatically added a UIWebView inside a UIPopoverController and set the webview to automatically detect URLs, phone numbers and addresses, by setting:

webView.dataDetectorTypes = UIDataDetectorTypeAll 

for the Webview.

The problem is that all links are handled correctly, except for the addresses, which return an error when clicked:

Unknown DDResult category 1 for result <DDResult:0xd4dcf60 WebURL [7:32, 7:44]>; could not find any actions for URL x-apple-data-detectors://1

When I add the Webview inside a UIView instead, the addresses are handled correctly and the Maps app opens and points to the address that was clicked.

Did anyone else encounter this problem with a Webview inside a UIPopoverController?


Solution

  • I have found the problem: I was initially loading a webview that had no addresses in it, then just switching the content of that webview with the new content which had addresses. I guess the webview was somehow still using the previous content when clicking an address. I solved the problem by creating 2 separate webviews and loading the appropriate content in each.