Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift / Xcode: WebProcessProxy Invalid connection identifier (web process failed to launch)

Tags:

xcode

macos

swift

I have a super simple Webview-loading tester app, but every time it tries to connect to the internet, the console shows:

WebProcessProxy::didFinishLaunching: Invalid connection identifier (web process failed to launch)

Here's the test app. This is all the custom code added after creating a blank SwiftUI app):

// ContentView.swift
import SwiftUI


struct ContentView: View {
  @State private var showWebView = false

  var body: some View {
    Button {
      showWebView.toggle()
    } label: {
      Text("Apple website")
    }
    .sheet(isPresented: $showWebView) {
      WebView(url: URL(string: "https://www.apple.com")!)
    }
  }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

// WebView.swift
import SwiftUI
import WebKit

struct WebView: NSViewRepresentable {
  
  var url: URL
  
  func makeNSView(context: Context) -> WKWebView {
    return WKWebView()
  }
  
  func updateNSView(_ webView: WKWebView, context: Context) {
    let request = URLRequest(url: url)
    webView.load(request)
  }
}

I've tried multiple WiFi connections so it's not something local.

like image 873
Will Taylor Avatar asked Jun 08 '26 13:06

Will Taylor


1 Answers

Solved.

In Signing & Capabilities, in the App Sandbox section => Network, tick the checkbox next to "Outgoing Connections (Client)"

like image 156
Will Taylor Avatar answered Jun 10 '26 05:06

Will Taylor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!