Reputation: 21
Presenting WKWebView to show web form, webview load successfully with following error "Error Domain=WKErrorDomain Code=5 "JavaScript execution returned a result of an unsupported type" UserInfo={NSLocalizedDescription=JavaScript execution returned a result of an unsupported type}", after loading webview clicked on date field and app freezes with following error "Failed to present a context menu for configuration with identifier _UIDatePickerCompactEditor. This is likely due to a different presentation occurring during the lifecycle of the interaction."
The web url working fine on iOS 13 and older and as well in xcode simulator safari.
HTML Tag:
<input type="date" name="ScheduleViewing/Date" id="ScheduleViewing/Date" class="form-control placeholder" value="" placeholder="Meeting Date *" style="background-color: transparent; position: relative; z-index: 1; background-position: initial initial; background-repeat: initial initial;">
iOS Code:
WKWebView *wkwebView = [[WKWebView alloc] initWithFrame:self.view.frame];
wkwebView.navigationDelegate = self;
NSURL *nsurl=[NSURL URLWithString:@" some url"];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[wkwebView loadRequest:nsrequest];
[self.view addSubview:wkwebView];
Upvotes: 0
Views: 1163
Reputation: 123
I met same error message and finally I fixed it.
But in my case, HTML is not <input type="date">
but <select>
. It is different point with your case.
My view controller's present(_:animated:completion:)
method was overridden like below:
override func present(_ viewControllerToPresent: UIViewController, animated: Bool, completion: (() -> Void)?) {
DispatchQueue.main.async {
super.present(viewControllerToPresent, animated: animated, completion: completion)
}
}
This code was written few years ago so that fix some problem occurs on iPad. The problem and solution is described in this question.
ios8 iPad uiwebview crashes while displaying popover when user taps drop down list HTML select tag
This code worked fine with old iOS (like iOS8,9), but I think this code may bring some side effects with recent iOS.
After I remove this overridden method, my app no longer produces such error.
Please check your present(_:animated:completion:)
method is overridden or not.
Upvotes: 0