NKWebView show "Allow to use Camera" in loop

Hello,

I try to create a simple app. I using a NKWebView. Everything works fine. But i using a QrScanner. When i using Safari, the page/scanner works fine. But inside the app not. When i reload the page inside my app, the message on the image will popup after reload every time. I click every time on "Allow" but is not working. But what I make wrong?

I added NSMicrophoneUsageDescription and NSCameraUsageDescription to my info.plist

This is my view code.

import UIKit
import WebKit

class ViewController: UIViewController {
    let webView = WKWebView()    

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        view.addSubview(webView)       

        guard let url = URL(string: "https://DOMAIN.io") else {
            return
        }

        webView.configuration.allowsInlineMediaPlayback = true
        webView.load(URLRequest(url:url))
    }   

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        webView.frame = view.bounds
    }
}

Do you mean WKWebView ?

Could you show the class where you use the scanner ?

It should be like:

class ScannerViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {

and call in viewDidLoad

        switch AVCaptureDevice.authorizationStatus(for: .video) { }

Yes

NKWebView show "Allow to use Camera" in loop
 
 
Q