garysimpson.dev
Mobile development with swift and flutter

WKWebView Entitlement Error?

November 27, 2024 at 11:28PM


I came across a pretty annoying issue in one of the view I use to display some custom html inside my app.



Invalid frame dimension (negative or non-finite).

Error acquiring assertion: <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}>

0x110025500 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=69259, 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}

After doing some digging and finding multiple posts (like this on stackoverflow) mentioning webView.allowsLinkPreview = true to no avail. I found the solution for me. Since I already had a WKNavigationDelegate all I needed to do was add the following.




    /// Used to allow for error free custom html loading.
    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction,
                 decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
        decisionHandler(.allow)
    }


Dec 2, 2024 update....

Turns out that solution was premature. Found another developer.apple post that solved it.



Goto MenuBar and find product -> Goto Menu menu -> Scheme -> Edit Scheme -> It comes up with popup -> Select "Run" - -> Select "Arguments" -> Then Environment Variables -> after this click on "+" button set "OS_ACTIVITY_MODE = disable"

Happy Coding ;-)