NWUDPSession and createUDPSession are deprecated

Hello,

I'm implementing a custom VPN protocol for iOS by extending NEPacketTunnelProvider. But I noticed methods related to creation of sockets are deprecated in iOS 18.

NEProvider.createUDPSession(), NEProvider.createTCPConnection(), NWTCPConnection, NWUDPSession, NEPacketTunnelProvider.createUDPSessionThroughTunnel() and NEPacketTunnelProvider.createTCPConnectionThroughTunnel() are all deprecated.

What we need to use as an alternative to these methods? If there is an alternative, how can we specify to use tunnel or not when creating connection?

Answered by DTS Engineer in 798201022

We have deprecated all of the In-Provider Networking APIs in favour of Network framework. This is inline with the advice from TN3151 Choosing the right networking API.

If you need to support older versions of iOS, it’s fine to continue to use the deprecated API. However, you should start to plan for the switch at some point.

In Network framework you have two options:

Share and Enjoy

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

Accepted Answer

We have deprecated all of the In-Provider Networking APIs in favour of Network framework. This is inline with the advice from TN3151 Choosing the right networking API.

If you need to support older versions of iOS, it’s fine to continue to use the deprecated API. However, you should start to plan for the switch at some point.

In Network framework you have two options:

Share and Enjoy

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

NWUDPSession and createUDPSession are deprecated
 
 
Q