UIWebView's selection menu doesn't appear the first time

During the iOS 9 beta this thread was posted about the tap-and-hold selection menu not appearing on UIWebView text the first time you perform a selection:


https://forums.developer.apple.com/message/54590


This issue still appears on iOS 9.0.2 and can be trivially reproduced with a sample application.


radar issue # is 23181314


Steps to Reproduce:

* Create new Xcode Project using the single-view application template.

* Drag a UIWebView onto the form.

* Create an outlet from the webview to the view controller.

* In the view controller's viewDidLoad (or viewDidAppear) load some HTML:

self.webView!.loadHTMLString("<p>foo bar baz</p><p>foo bar baz</p>", baseURL: nil)

* Run the application.

* Long-press/tap on the html text.


Expected Results:

The text should be highlighted blue AND the selection menu (containing Copy, etc. menu items) should appear.


Actual Results:

The selection menu does not appear. This only happens the first tiem, subsequent selections do show the selection menu.

Replies

See also this stackoverflow question from the author of the original thread:


http://stackoverflow.com/questions/32685198/uimenucontroller-editing-menu-in-uiwebview-only-appears-second-time

The workaround in the answer to the SO question works for me: http://stackoverflow.com/a/33077990/49658

Same issue for me.

The proposed workaround doesn't work for me.

I have filed a radar :

23640998

I have also tested on WKWebView and it has the same issue

Still not corrected in 9.3

same issue


but [uiweview reload] may be useful

This appears to be working correctly in iOS 10 Beta 3.

Yes, confirmed. It's working fine in iOS 10 Beta3