NWEndpoint.hostPort(host: , port: ) crash in Xcode15

got crash when use xcode15 + iOS16, works fine one xcode15 + iOS17.

example code: let httpsHost1 = NWEndpoint.Host("example.com") //crash

let httpsHost2 = NWEndpoint.hostPort(host: "example.com", port: NWEndpoint.Port(rawValue: 80)!) // crash too

why xcode cant compatible that?anyone helpppppppppp? : (

Replies

example code:

let httpsHost1 = NWEndpoint.Host("example.com") //crash

This is working for me. I’d like to see a crash report for it. Run your app outside of Xcode to generate that, then post it here using the steps from Posting a Crash Report.

Share and Enjoy

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

  • Same issue #0 0x0000000000000000 in 0x00000000 () #1 0x0000000107ef7fdc in type metadata accessor for NWInterface.InterfaceType? () #2 0x0000000107ef7efc in type metadata completion function for PeasyConnectionHealthyMeasure () #3 0x00000001bacde170 in swift::MetadataCacheEntryBase<(anonymous namespace)::SingletonMetadataCacheEntry, int>::doInitialization(swift::MetadataWaitQueue::Worker&, swift::MetadataRequest) () #4 0x00000001bacccddc in swift_getSingletonMetadata ()

Add a Comment

i figured out the crash. when your project set IPHONEOS_DEPLOYMENT_TARGET=11 on xcode15.

you got crash when run in ios16(ios17-). i check the macho file and project linked Network.framework auto.

it works fine on xcode 14.3(xcode15-) cause it linked libswiftNetwork.dylib. why Network.framework will bring the crash?

xcode should show tip to developers not crash directly. so if you got same problem plz set IPHONEOS_DEPLOYMENT_TARGET = 12 and fixed!

here is example demo: https://github.com/aklee/Xcode15Crash

@eskimo @Abelchen

Add a Comment

Xcode 15’s minimum deployment target is iOS 12, so this problem isn’t too surprising.

What is surprising is that Xcode is not warning you about this. When I force the deployment target to iOS 11, I get this message:

…/Test737672.xcodeproj 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.

Did you not get that?

Share and Enjoy

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

i got nothing but the crash. lots developers set min < 12 and they will very confuse. i was trapped by the problem for serval days cause dont know where is the trick. ;(

i got nothing but the crash.

Interesting. Here’s what I did:

  1. Using Xcode 15.0, I created a new project from the iOS > App template, selecting Swift and Storyboard.

  2. In the General tab of the target editor I manually set the Minimum Deployments > iOS combo box to 11.0.

  3. I chose Product > Build.

I got a lot of errors because the template relies on UIScene, but at the top of the error list is the warning I mentioned above.

If you do the above, do you see the same result?

Share and Enjoy

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

  • maybe the project should created by old xcode version? you can try the demo posted on github. maybe check diff project.pbxproj between your demo and my demo.

Add a Comment

I'm stepping across the same problem. I already filled up bug report: FB13278576.

@eskimo Yes, Xcode 15 properly prints the warning of IPHONEOS_DEPLOYMENT_TARGET set to iOS 11 vs Xcode 15 requiring minimum iOS 12. However, because this is just a warning, I'd expect the app to run with no problem on any iOS from 12.0 to 17. Instead, it crashes when hitting any symbol from Network lib. I attached the crash report to this post.

Repro steps:

  1. Create an Xcode 14 project, chose iOS 11 for IPHONEOS_DEPLOYMENT_TARGET. Adjust the app's startup code to build for iOS 11.
  2. Add some code that uses the Network module, like:
import Network

if #available(iOS 12.0, *) {
    _ = NWEndpoint.Host("example.com")
}
  1. Open this project in Xcode 15.0.
  2. Run it on device with iOS prior to 17.0.

The app will crash on NWEndpoint.Host("example.com").

Now, I understand that the problem is surfaced by following:

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.

but either the severity of this message is wrong (it is a build warning, not error) or there is a problem with loading Network lib in explained setup.

We're particularly hit by this issue as a vendor lib developers. Because our library depends on Network and our customers build it from source code, we can't enforce all of them to fix their IPHONEOS_DEPLOYMENT_TARGET when migrating from Xcode 14 to Xcode 15. They ignore the warning and report the crash to us.

I'd expect the app to run with no problem on any iOS from 12.0 to 17.

That is an incorrect expectation.

the severity of this message is wrong

I agree with your here.

They ignore the warning and report the crash to us.

I think you’ll be able to head this off by adding a compile-time trap to your project. That is, code that fails to compile if you attempt to build it with a deployment target that’s not supported by the version of Xcode being used.

However, I’ve not actually tried this so I don’t have any specific advice. You’ll have to do some experimentation.

Share and Enjoy

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

😭😭😭 Really suggest it should fixed in next xcode version.

Really suggest it should fixed in next xcode version.

What are you expecting to be fixed here? It’s seems unlikely that we’ll lower Xcode’s minimum deployment target, so the best you can hope for is Xcode being better about telling you about the problem.

Share and Enjoy

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