Xcode 15.0 Beta: NEPacketTunnelProvider is only available in tvOS 17.0 or newer

I'm researching to develop a VPN application on tvOS 17.0, but even if I set the dev target version to 17.0, it still prompts me that the API is not available.

'NEPacketTunnelProvider' is only available in tvOS 17.

0 or newer

I have 2 xcodes installed on my computer, I tried switching to sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer, but it still doesn't work. Is there anything else I need to set?

Answered by munibsiddiqui in 768447022

@eskimo We managed to solve this issue. Looks like a bug on xcode 15+

The simplest solution is to change the productType of your Network Extension target from com.apple.product-type.tv-app-extension to com.apple.product-type.app-extension.

Details can be found here: https://medium.com/@munibsiddiqui/fix-nsextensionprincipalclass-packettunnelprovider-must-implement-at-least-one-public-55963b76c9cd

Somehow it's working fine again. however the extension keeps not working:

ASI found [CoreFoundation] (sensitive) '*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** NSExtensionPrincipalClass PacketTunnel.PacketTunnelProvider must implement at least one public protocol''

class PacketTunnelProvider: NEPacketTunnelProvider {
    
    override func startTunnel(options: [String : NSObject]? = nil, completionHandler: @escaping (Error?) -> Void) {
        completionHandler(nil)
    }
    
    override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
        completionHandler()
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>
	<key>NSExtension</key>
	<dict>
		<key>NSExtensionPointIdentifier</key>
		<string>com.apple.networkextension.packet-tunnel</string>
		<key>NSExtensionPrincipalClass</key>
		<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
	</dict>
</dict>
</plist>

Xcode version: 15.0 Beta

tvOS version: 17.0 (21J5273q)

How did you solve the problem "*** NSExtensionPrincipalClass PacketTunnel.PacketTunnelProvider must implement at least one public protocol"

Do you have a solution?

See this thread. It doesn’t have any real answers yet, but if I uncover anything new I’ll update that thread rather than this one.

Share and Enjoy

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

Accepted Answer

@eskimo We managed to solve this issue. Looks like a bug on xcode 15+

The simplest solution is to change the productType of your Network Extension target from com.apple.product-type.tv-app-extension to com.apple.product-type.app-extension.

Details can be found here: https://medium.com/@munibsiddiqui/fix-nsextensionprincipalclass-packettunnelprovider-must-implement-at-least-one-public-55963b76c9cd

Xcode 15.0 Beta: NEPacketTunnelProvider is only available in tvOS 17.0 or newer
 
 
Q