NWConnection Crash

After upgrading to xcode17, when I use init(host: NWEndpoint.Host, port: NWEndpoint.Port, using: NWParameters) to initialize the NWConnection, it runs on ios16.1 and crash!How to fix this problem?

Almost the same thing

macOS 13.5.2 (22G91) XCode 15.0 (15A240d) iOS 16.6.1 (20G81)

Crash on NWParameters init

Now the whole project is broken

I try,normal for ios12+

Same here XCode 15.0.1 - Crash on NWParameters init

Did you find any solution ?

I’m not sure how you’re triggering this, but I can’t reproduce it. Here’s what I did:

  1. Using Xcode 15.0 on macOS 13.6.1, I created a new project from the iOS > App template.

  2. I added a button to ContentView:

    Button("Test") {
        let p = NWParameters()
        print(p)
    }
    
  3. I ran it on the iOS 16.4 simulator.

  4. I tapped the button.

It didn’t crash, but rather printed:

generic, attribution: developer

Please try repeating the above steps and let me know what you get.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi,

override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view.

    if #available(iOS 14.0, *) {
        let parameters = NWParameters()
        parameters.includePeerToPeer = true
    }
}

This error shows up only with XCode 15.0.1 , when the minimum os version is less than 12.0 and on old os version (tested on 15.7.x) . Any other combination will work.

when i changed the min os version to 12.0 it solved the issue.

Thanks

Confirm. Changing min deployment target to iOS 12 from iOS 11 solves the issue

when the minimum os version is less than 12.0

I’m not surprise you were having problems with that. Xcode 15’s minimum supported deployment target is iOS 12.

I am surprised you didn’t get a build warning. In my test project, the lowest value available in the iOS Deployment Target popup is 12.0. And if I manually type in 11.0, I get a build warning of The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

hi eskimo, Thanks for ur reply, have tested following combinations with Xcode 15.1 beta 3: 1.iOS 17.1.1/ iOS 12.5.7, minimum deployment target 11, NWParameters.init() works fine 2.iOS 16/15, minimum deployment target 11, NWParameters.init() crash 3.iOS 16/15, minimum deployment target 12: NWParameters.init() works fine

Just curious if iOS 11 is no longer supported by Xcode 15, how this inconsistency situations happened?. Could this inconsistency be attributed to a new linker issue introduced in Xcode 15.0 here https://developer.apple.com/forums/thread/738317 ? I'm wondering if there's a chance for this to be addressed in a future release. Could you please help to confirm? Thanks

NWConnection Crash
 
 
Q