在iOS8和iPad上,如果uiwebview
显示包含下拉列表的HTML页面
例如此页面http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select
然后:
- 重复点击包含汽车列表的HTML下拉列表。第一项是沃尔沃。
- 每隔半秒钟左右轻点一次,直到弹出窗口打开并关闭。
- 应用程序将崩溃:
Terminating app due to uncaught exception 'NSGenericException',[...] 'UIPopoverPresentationController () should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
是否有任何方法可以在uiwebview
中解决此问题?
使用wkwebview
不会发生这种情况,但我想在uiwebview
中修复它。
更新:以下似乎有所帮助,但不确定副作用。我已经在包含uiwebview
的视图控制器中覆盖了以下内容。
-(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
{
if (completion)
{
completion();
}
[super dismissViewControllerAnimated:NO completion:nil];
}