Skip to content

Instantly share code, notes, and snippets.

@kishikawakatsumi
Created June 12, 2025 16:25
Show Gist options
  • Save kishikawakatsumi/cbc6a62a8486b833898136af76401938 to your computer and use it in GitHub Desktop.
Save kishikawakatsumi/cbc6a62a8486b833898136af76401938 to your computer and use it in GitHub Desktop.
When the deployment target is iOS 16, NWConnection init crashes on the simulator.
When the following code is executed in a project with the deployment target set to iOS 16, the `init` function of `NWConnection` crashes.
This issue only occurs on the iOS 26 simulator. There is no problem on the device.
```swift
import UIKit
import Network
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let endpoint = NWEndpoint.hostPort(
host: NWEndpoint.Host("192.168.1.188"),
port: NWEndpoint.Port(integerLiteral: 445)
)
let connection = NWConnection(to: endpoint, using: .tcp) // <= Crash here
print(connection)
return true
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment