defaultPath deprecated in NEProvider

The documentation for the defaultPath property of NEProvider is as follows:

This NWPath object contains information about which physical network interface will be used by connections opened by the Network Extension provider. You can determine when this physical interface changes by observing this property using KVO.

However, I have noticed that it is deprecated as of iOS 18.

Is there any existing replacement for this functionality since it has been deprecated, or is a new replacement on the horizon? This is very useful for network extensions in order to detect changes to the network, for instance when moving from WiFi to mobile data.

Answered by DTS Engineer in 809683022

It was deprecated because it uses the legacy NWPath type (rather than the NWPath from Network framework). In the latest SDKs we’ve formally deprecated all of these old-school in-provider-networking types. We’ve been generally recommending that you not use them for a while. For example, I cover this in TN3151 Choosing the right networking API.

In this case the ‘drop-in’ replacement is NWPathMonitor. We even say as much in the deprecation notice:

@property (readonly, nullable) NWPath *defaultPath API_DEPRECATED("Use nw_path_monitor_t in Network framework instead", …) …;

Of course, that might not be the best option. NWConnection has a variety of path update handlers that will likely yield more info that’s more specific to your needs.

Share and Enjoy

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

Accepted Answer

It was deprecated because it uses the legacy NWPath type (rather than the NWPath from Network framework). In the latest SDKs we’ve formally deprecated all of these old-school in-provider-networking types. We’ve been generally recommending that you not use them for a while. For example, I cover this in TN3151 Choosing the right networking API.

In this case the ‘drop-in’ replacement is NWPathMonitor. We even say as much in the deprecation notice:

@property (readonly, nullable) NWPath *defaultPath API_DEPRECATED("Use nw_path_monitor_t in Network framework instead", …) …;

Of course, that might not be the best option. NWConnection has a variety of path update handlers that will likely yield more info that’s more specific to your needs.

Share and Enjoy

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

defaultPath deprecated in NEProvider
 
 
Q