How to add WebKit Entitlement

I have an iOS native app. I have added WKWebView to view controller to show html content.

class MyHTML1ViewController: UIViewController {
  private var webView: WKWebView!
  var htmlFile: String = "" // default value, can be changed
  override func viewDidLoad() {
     super.viewDidLoad()
     let url = Bundle.main.url(
        forResource: htmlFile,
        withExtension: "html")

     let request = URLRequest(url: url)
     webViewBase.load(request)
 }
...
}

I run the app on my iPhone through Xcode. It displays html content fine. However, on closing the view, I saw the following error messages in console:

ProcessAssertion: Failed to acquire RBS assertion 'WebProcess 
Suspended Assertion'
for process with PID=91330, error: Error Domain=RBSServiceErrorDomain Code=1 
"target is not running or doesn't have entitlement 
 com.apple.runningboard.assertions.webkit"
 UserInfo={NSLocalizedFailureReason=target is not running 
 or doesn't have entitlement    
 com.apple.runningboard.assertions.webkit}>

Should I add webkit entitlement? how can I do it in Xcode? I prefer to get rid of this error message if they are just warning in console, does not causing app crash.

My Xcode is Version 13.4.1.

I was told that I can ignore the error message. I have uploaded to TestFlight, my testers can open view controller with WKWebView and no any crash.

I'm having the same Issue. Testflight Version also doesn't open the specific link. The Problem only occurs with certain URLs that initiate a re-direct request I guess...

WKNavigationType is always other and if I add

  if navigationAction.navigationType == WKNavigationType.other {
         
            webView.load(navigationAction.request)
            decisionHandler(.cancel)
            return
        }

The WebView is entering a never ending loop/cycle...

any idea or solution yet?

how did you do it in the end?

How to add WebKit Entitlement
 
 
Q