WKWebview和<input type =“file”

我在iOS上遇到了WKWebView的问题。 在录制元素出现ActionSheet,其中包含三个选项: Photo LibraryiCloudCancel

然后,当我点击照片库时 ,ActionSheet消失,WebView阻止再次打开ActionSheet。 我被卡住,通过WebView上传照片。

我在info.plist文件中添加了权限(隐私 – 照片库使用说明)。 这是我创建WebView的方法

 WKWebViewConfiguration *wkConfiguration = [[WKWebViewConfiguration alloc] init]; wkConfiguration.allowsInlineMediaPlayback = true; wkConfiguration.mediaPlaybackRequiresUserAction = false; self.webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:wkConfiguration]; self.webView.scrollView.bounces = NO; self.webView.contentScaleFactor = 2.0; self.webView.exclusiveTouch = YES; [self.webView.scrollView setDelaysContentTouches:NO]; [self.webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal]; self.webView.UIDelegate = self; self.webView.navigationDelegate = self; 

最糟糕的是,我无法在输入上捕捉到点击事件。 也许有人有类似的问题? 我从Stack和Apple论坛搜索了其他主题,但都没有帮助。 我将非常感谢你的帮助。

编辑

系统日志正在打印:

 : -[NETAWDManager reportStats:metricID:] AWDServerConnection newMetricContainerWithIdentifier failed for metric 2686983, server 0x16d62570, not reporting:  { cellularFallbackReport = { dataUsageSnapshotsAtNetworkEvents = ( { bytesIn = 1999999; bytesOut = 1600; } ); "fallbackTimer_msecs" = 0; fellback = 0; networkEvents = ( "NETWORK_EVENT_DATA_STALL_AT_APP_LAYER" ); "timeToNetworkEvents_msecs" = ( 5168 ); }; clientIdentifier = "com.apple.WebKit.Networking"; connectionStatisticsReport = { DNSAnswersCached = 0; "DNSResolvedTime_msecs" = 0; RTTvariance = 0; "appDataStallTimer_msecs" = 3; appReportingDataStallCount = 1; "bestRTT_msecs" = 0; betterRouteEventCount = 0; bytesDuplicate = 0; bytesIn = 2700000; bytesOut = 3800; bytesOutOfOrder = 0; bytesRetransmitted = 0; cellularFallback = 0; cellularRRCConnected = 0; connected = 1; connectedInterfaceType = "(unknown: 4)"; "connectionEstablishmentTime_msecs" = 1; connectionReuseCount = 0; "currentRTT_msecs" = 0; "flowDuration_msecs" = 40208; interfaceType = "(unknown: 4)"; kernelReportedStalls = 0; kernelReportingConnectionStalled = 0; kernelReportingReadStalled = 0; kernelReportingWriteStalled = 0; packetsDuplicate = 0; packetsIn = 210; packetsOut = 9; packetsOutOfOrder = 0; packetsRetransmitted = 0; "smoothedRTT_msecs" = 0; synRetransmissionCount = 0; tcpFastOpen = 0; "timeToConnectionEstablishment_msecs" = 2; "timeToConnectionStart_msecs" = 1; "timeToDNSResolved_msecs" = 0; "timeToDNSStart_msecs" = 0; trafficClass = 0; }; delegated = 1; reportReason = "REPORT_REASON_DATA_STALL_AT_APP_LAYER"; sourceAppIdentifier = "com.supermemo.sm-com"; } Jul 6 10:13:59 iPad-xxx assistantd[268] : tcp_connection_tls_session_error_callback_imp 7 __tcp_connection_tls_session_callback_write_block_invoke.434 error 22 Jul 6 10:13:59 iPad-xxx assistantd[268] : NSURLSessionStreamTask: TCPConnection read invalidated by closed connection Jul 6 10:13:59 iPad-xxx networkd[87] : -[NETAWDManager reportStats:metricID:] AWDServerConnection newMetricContainerWithIdentifier failed for metric 2686980, server 0x16d62570, not reporting:  { "client_id" = assistantd; "establishment_cellular_fallback" = 0; "establishment_failure_error" = 0; "establishment_forced_tcp_fallback" = 0; "establishment_interface_name" = en0; "establishment_success" = 1; "establishment_syn_retransmits" = 0; "establishment_tcp_fallback" = 0; "establishment_time" = "0.0573505"; "interface_reports" = ( { "data_in_KB" = 5; "data_out_KB" = 2; "interface_name" = en0; "post_connect_subflow_failure_errors" = ( ); "post_connect_tcp_fallback_count" = 0; "secondary_flow_failure_count" = 0; "secondary_flow_success_count" = 0; } ); "post_connect_multi_homed" = 1; "post_connect_session_lifetime" = "42.711159041"; "post_connect_single_homed" = 0; "post_connect_subflow_attempt_count" = 2; "post_connect_subflow_max_subflow_count" = 1; "subflow_switching_count" = 0; } 

WKWebView使用一些安全协议从OS获取文件? 有谁知道如何处理这个?

我终于解决了。 我不得不实现UIViewController方法:

 -(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion { if (self.presentedViewController){ [super dismissViewControllerAnimated:flag completion:completion]; }