# WKWebView Blank in a Sandboxed Mac App

> A sandboxed macOS app showing a blank WKWebView on launch? loadFileURL needs the network.client entitlement, even if nothing touches the network.

- Author: Curtis Miller
- Published: 2026-11-15
- Categories: gotchas, macos, safari
- Canonical URL: https://millarian.com/posts/wkwebview-blank-sandboxed-mac-app/

My macOS app showed a blank window on launch. The window was a `WKWebView` loading a local HTML file from the app bundle, and App Review rejected it under Guideline 2.1(a): "We were unable to access the app because the app was frozen with blank page upon launch." The same build had looked fine on my machine.

## Turning off a capability that looked unused

The app was the macOS host app for a Safari web extension. The extension's whole point is that it never sends anything anywhere. The project generated by `xcrun safari-web-extension-converter` turns on Outgoing Connections (Client) under Signing & Capabilities, App Sandbox. That looked unnecessary for an app with no network code, so I turned it off. In the project file, that is this build setting:

```text
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
```

I set it to `NO`, and the entitlements file lost its `network.client` key.

## Why a local file needs the network entitlement

The app's only job is to show a bundled page:

```swift
let url = Bundle.main.url(forResource: "Main", withExtension: "html")!
webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent())
```

No request leaves the machine, but WebKit loads even local files through a separate networking process. Without the client entitlement, the sandbox blocks that process and the web view stays blank. Nothing crashes or logs an obvious error, so the app just looks frozen.

I didn't see it locally, most likely because of how I was running the app (debug runs and earlier builds). The reviewer ran the real sandboxed build and got a white window.

## The fix: put the entitlement back

Set Outgoing Connections (Client) back on. Before you resubmit, build Release and check what the app is signed with:

```bash
codesign -d --entitlements - "MyExtension.app"
```

The output should include `com.apple.security.network.client`. Then open that built `.app` directly, not from Xcode, and confirm the page shows up.

The entitlement only permits outgoing connections. It doesn't make any. My extension still sets `connect-src 'none'` in its Content Security Policy, and that is what keeps it from talking to the network. The sandbox entitlement was never the privacy guarantee.
