Calling "mediaDevices.getUserMedia{video: true})" closes the application

Basically what the title says. I call mediaDevices.getUserMedia{video: true}) and the application just exits without an error message. I’m using an iPhone to test and I have:

NSCameraUsageDescription
Allow $(PRODUCT_NAME) to access your camera
NSMicrophoneUsageDescription
Allow $(PRODUCT_NAME) to access your microphone

in my Info.plist. I’m not sure what to do here as there is no error message. Can anyone shed any light as to why this is happening?