0

I want to load my web app inside my iOS application using WKWebView. My web app built with react and has a feature to take a photo inside my app. I am using https://github.com/purple-technology/react-camera-pro for the camera libray. So when opening the camera page from the web app, I requested camera access with

AVCaptureDevice.requestAccess(for: .video) { [weak self] granted in
    // send JSBridge event
}

That will show a popup for requesting camera permission for my app enter image description here

But after that another similar popup will appear. enter image description here

This is how I create my WKWebView

let config = WKWebViewConfiguration()
config.websiteDataStore = WKWebsiteDataStore.default()
let webView = WKWebView(frame: CGRect.zero, configuration: config)

I want to remove the second request permission popup because it just feel useless because I already approve the first permission. Is there any way to do this?

Sonic Master
  • 1,238
  • 2
  • 22
  • 36
  • The only way to avoid it is not to use a web view. A web view is not considered part of your app. Any web site could be loaded into a web view, so the user needs to provide permission for that site to access the camera independently of your app. – Paulw11 Jun 07 '23 at 19:35
  • @Paulw11 I do no thonk you are right, seems that solution exists. Question is duplicate of https://stackoverflow.com/questions/75310858/browser-also-asks-camera-permission-in-ios-webview – mikep Aug 03 '23 at 21:16
  • Good find. This [wwdc video](https://developer.apple.com/wwdc21/10032?time=949) explains more – Paulw11 Aug 03 '23 at 21:35

0 Answers0