WkwebView 崩溃请求音频和麦克风弹出 ios 15.4
WkwebView Crash On request audio & microphone pop up ios 15.4
我在 Iphone.When 尝试更改视图内的导航 link 时遇到未知错误 link 请求摄像头和麦克风权限。当尝试查看 WKWebView 和它崩溃的设备之间的警报时。
无法在非主线程上调用 asCopy = NO。
+[UIView setAnimationsEnabled:] 从后台线程调用。不支持从后台线程对 UIView 或子类执行任何操作,这可能会导致意外和隐蔽的行为。踪迹=(....)
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull void (^)(WKNavigationActionPolicy))decisionHandler {
dispatch_async(dispatch_get_main_queue(), ^{
if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
if (navigationAction.request.URL) {
if (![navigationAction.request.URL.resourceSpecifier containsString:@"ex path"]) {
if ([[UIApplication sharedApplication] canOpenURL:navigationAction.request.URL]) {
//------>
UIApplication *application = [UIApplication sharedApplication];
[application openURL:navigationAction.request.URL options:@{} completionHandler:nil];
decisionHandler(WKNavigationActionPolicyCancel);
}else{
}
} else {
decisionHandler(WKNavigationActionPolicyAllow);
}
}
}
else if (navigationAction.request.URL && [[NSString stringWithFormat:@"%@",navigationAction.request.URL] rangeOfString:@"disconnectChat"].location != NSNotFound ){
decisionHandler(WKNavigationActionPolicyAllow);
[UIView animateWithDuration:0.5 animations:^{
self->_thankYouView.hidden = NO ;
} completion:^(BOOL finished) {
}];
}
else {
//------>
decisionHandler(WKNavigationActionPolicyAllow);
}
});
}
试试这个
- (void) webView:(WKWebView *)webView
requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin
initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type
decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandlerii
API_AVAILABLE(ios(15.0))
{
decisionHandler(WKPermissionDecisionGrant);
}
我在 Iphone.When 尝试更改视图内的导航 link 时遇到未知错误 link 请求摄像头和麦克风权限。当尝试查看 WKWebView 和它崩溃的设备之间的警报时。
无法在非主线程上调用 asCopy = NO。
+[UIView setAnimationsEnabled:] 从后台线程调用。不支持从后台线程对 UIView 或子类执行任何操作,这可能会导致意外和隐蔽的行为。踪迹=(....)
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull void (^)(WKNavigationActionPolicy))decisionHandler {
dispatch_async(dispatch_get_main_queue(), ^{
if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
if (navigationAction.request.URL) {
if (![navigationAction.request.URL.resourceSpecifier containsString:@"ex path"]) {
if ([[UIApplication sharedApplication] canOpenURL:navigationAction.request.URL]) {
//------>
UIApplication *application = [UIApplication sharedApplication];
[application openURL:navigationAction.request.URL options:@{} completionHandler:nil];
decisionHandler(WKNavigationActionPolicyCancel);
}else{
}
} else {
decisionHandler(WKNavigationActionPolicyAllow);
}
}
}
else if (navigationAction.request.URL && [[NSString stringWithFormat:@"%@",navigationAction.request.URL] rangeOfString:@"disconnectChat"].location != NSNotFound ){
decisionHandler(WKNavigationActionPolicyAllow);
[UIView animateWithDuration:0.5 animations:^{
self->_thankYouView.hidden = NO ;
} completion:^(BOOL finished) {
}];
}
else {
//------>
decisionHandler(WKNavigationActionPolicyAllow);
}
});
}
试试这个
- (void) webView:(WKWebView *)webView
requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin
initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type
decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandlerii
API_AVAILABLE(ios(15.0))
{
decisionHandler(WKPermissionDecisionGrant);
}