When NEPacketTunnelProvider popup for user's permission gets trigger

I want to understand in which API triggers this below popup.

1. This below code always trigger popup after fresh install which make sense:

`//manager NETunnelProviderManager

manager.connection.startVPNTunnel(options: [:])`

2. This below code sometime triggers popup intermittently. Ideally this shouldn't trigger or always trigger.

I tried running this code in loop to check this behaviour, some time around 50th or sometime around 88th execution observed this popup.

        config.providerBundleIdentifier =“bundleId”
        config.serverAddress = "Connection managed by app”Name//
        
        let manager = NETunnelProviderManager()
        manager.protocolConfiguration = config
        manager.localizedDescription = “xyz”
        
        
        manager.saveToPreferences(completionHandler: { (saveError) -> Void in

	}```

no where startVPNTunnel called in 2nd code sample.

You should only see it show up when you create a new configuration.

This below code sometime triggers popup intermittently.

That seems bugworthy.

I tried running this code in loop

In that loop are you waiting for the completion handler to be called before you call saveToPreferences(completionHandler:) again?

Regardless, this is weird code. Normally you don’t create a new NETunnelProviderManager each time. Rather, when updating a configuration you call NETunnelProviderManager.loadAllFromPreferences(completionHandler:), modify that, and then save it back.

Share and Enjoy

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

When NEPacketTunnelProvider popup for user's permission gets trigger
 
 
Q