Hi Matt, thank you for your speedy reply!
Since the user is starting the connection, what is wrong with having the user initiate the connection from either the container app or the VPN Settings in the Settings app?
We support both, but that's not what this is about. :-) My concern is: if the user stops the connection and the house-keeping is taking very long (say, it takes a minute), it would be good if the user would still be able to start a new connection.
As a test I just delayed calling the callback of stopTunnelWithReason: using dispatch_after by 30 seconds. During this time, the connection is in "stopping" state and the user has to wait this whole time until they can start the connection again.
As for keeping the process alive, no, stopTunnelWithReason is call as part of the process to destroy the packet tunnel provider so any attempts to keep the process alive could end up with strange behavior.
I was hoping that I could do the cleanup in something like the background tasks for UI processes: https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/extending_your_app_s_background_execution_time
If something like this would be supported in a network extension, I could bring the connection down, then call the stopTunnelWithReason: callback, and only then do the house-keeping. This ways the user (or system, with on-demand rules) would be able to restart the connection more quickly.
Tear everything down, do house-keeping, and then call cancelTunnelWithError.
Thank you for clearing this up.
Post
Replies
Boosts
Views
Activity
I see you have .supportedFamilies(…) which was missing in my widget. I just added it, but it doesn't make any difference: I still only get .systemMedium, even for the small and large widgets, and none of the other @Environment properties work.
Thank you, Kevin. Developer Mode really is active on the 14.x device I was testing on.
Is there a recommended way to test whether a directory meets the System Extension requirements? This is for code that checks whether the app is in a supported location and offers to move it to /Applications if it isn't.
macOS 14 does not have this dialog. See detailed answer below.