Created
June 12, 2025 16:25
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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