Crash when requesting permissions for getUserMedia in WKWebView

WebRTC getUserMedia support was added in iOS 14.3.

On the first launch of my app I show a WebView pointing to my URL and request getUserMedia inside it when the user clicks a button. The app then brings up a permissions dialog with the request for the app. Upon selecting accept the application crashes. Subsequent launches of the app bring up the dialog, but with the address of the page being the requestor and it succeeds. Looking at the permissions, the application permission for Camera was already accepted.

I don't see my code in the backtrace. Any ideas on where I should look more?

Last Exception Backtrace:
0 CoreFoundation 0x1966fd86c _exceptionPreprocess + 220 (NSException.m:199)
1 libobjc.A.dylib 0x1ab66cc50 objc
exceptionthrow + 60 (objc-exception.mm:565)
2 CoreFoundation 0x196603000 +[NSException raise:format:arguments:] + 100 (NSException.m:146)
3 Foundation 0x19799791c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 132 (NSException.m:231)
4 UIKitCore 0x198607368 -[
UISimpleFenceProvider trackSystemAnimationFence:] + 224 (UISimpleFenceProvider.m:51)
5 UIKitCore 0x1990ace28 -[UIApplication
trackSystemAnimationFence:] + 88 (UIApplication.m:2167)
6 UIKitCore 0x199100988 +[UIWindow synchronizeDrawingWithFence:preCommitHandler:] + 92 (UIWindow.m:4928)
7 UIKitCore 0x198536104 -[UIScene
synchronizeDrawingWithFence:] + 76 (UIScene.m:643)
8 UIKitCore 0x198ee76e8 -[UIRemoteKeyboards prepareToMoveKeyboard:withIAV:isIAVRelevant:showing:notifyRemote:forScene:] + 940 (UIRemoteKeyboards.m:1702)
9 UIKitCore 0x198afc48c -[UIInputResponderController prepareToMoveKeyboardForInputViewSet:animationStyle:] + 488 (UIInputResponderController.m:1624)
10 UIKitCore 0x198afa7a4 -[UIInputResponderController setKeyWindowSceneInputViews:animationStyle:] + 684 (UIInputResponderController.m:1432)
11 UIKitCore 0x198afa4c4 -[UIInputResponderController setInputViews:animationStyle:] + 236 (UIInputResponderController.m:0)
12 UIKitCore 0x198afba20 -[UIInputResponderController setInputViews:animated:] + 100 (UIInputResponderController.m:1539)
13 UIKitCore 0x198afba9c -[UIInputResponderController setInputViews:] + 80 (UIInputResponderController.m:1544)
14 UIKitCore 0x198af9330 _74-[UIInputResponderController reloadInputViewsForKeyWindowSceneResponder:]blockinvoke.666 + 40 (UIInputResponderController.m:1055)
15 UIKitCore 0x198af8e0c -[UIInputResponderController reloadInputViewsForKeyWindowSceneResponder:] + 3972 (UIInputResponderController.m:1091)
16 UIKitCore 0x198af7e5c -[UIInputResponderController
reloadInputViewsForResponder:] + 164 (UIInputResponderController.m:0)
17 UIKitCore 0x198afe834 -[UIInputResponderController preserveInputViewsWithId:animated:reset:] + 132 (UIInputResponderController.m:2102)
18 UIKitCore 0x19899c730 -[UIViewController
presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1292 (UIViewController.m:7215)
19 UIKitCore 0x19899fdbc -[UIViewController presentViewController:withAnimationController:completion:] + 4368 (UIViewController.m:7598)
20 UIKitCore 0x1989a0d40
63-[UIViewController presentViewController:animated:completion:]blockinvoke + 108 (UIViewController.m:7956)
21 UIKitCore 0x1989a10a0 -[UIViewController performCoordinatedPresentOrDismiss:animated:] + 536 (UIViewController.m:8096)
22 UIKitCore 0x1989a0c8c -[UIViewController
presentViewController:animated:completion:] + 216 (UIViewController.m:7963)
23 UIKitCore 0x1989a117c -[UIViewController presentViewController:animated:completion:] + 188 (UIViewController.m:8040)
24 WebKit 0x1a2ec7400 WebKit::UserMediaPermissionRequestProxy::doDefaultAction() + 1056 (UserMediaPermissionRequestProxy.mm:115)
25 WebKit 0x1a2f0e290 *::Detail::CallableWrapper<WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest(*::Vector<WebCore::CaptureDevice, 0ul, *::CrashOnOverflow, 16ul, *::FastMal... + 260 (UserMediaPermissionRequestManagerProxy.cpp:584)
26 WebKit 0x1a2cdd714 *::CompletionHandler<void (bool)>::operator()(bool) + 44 (Function.h:83)
27 JavaScriptCore 0x1a094e504
*::RunLoop::performWork() + 484 (Function.h:83)
28 JavaScriptCore 0x1a094f1ec ***::RunLoop::performWork(void*) + 36 (RunLoopCF.cpp:46)
29 CoreFoundation 0x19667976c CFRUNLOOPISCALLINGOUTTOASOURCE0PERFORMFUNCTION + 28 (CFRunLoop.c:1967)
30 CoreFoundation 0x196679668 _CFRunLoopDoSource0 + 208 (CFRunLoop.c:2011)
31 CoreFoundation 0x196678960
CFRunLoopDoSources0 + 268 (CFRunLoop.c:2048)
32 CoreFoundation 0x196672a8c
CFRunLoopRun + 824 (CFRunLoop.c:2925)
33 CoreFoundation 0x19667221c CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
34 WebCore 0x1a41ccccc RunWebThread(void*) + 656 (WebCoreThread.mm:652)
35 libsystem
pthread.dylib 0x1e1ecdb40 pthreadstart + 320 (pthread.c:881)
36 libsystempthread.dylib 0x1e1ed6768 threadstart + 8


Hi, I faced the same issue, do you know how to fix it now?

Any update on this issue? Is it happening only when getting permission for getUserMedia in WKWebView

Crash when requesting permissions for getUserMedia in WKWebView
 
 
Q